In C++ Please :
Write two statements to read in values for birthMonth followed by birthYear, separated by a space. Write a statement to print the date using the format birthMonth/birthYear. Ex: 1 2000 (User's input), 1/2000 (Program's output)

Respuesta :

Answer:

  1.    int birthMonth, birthYear;
  2.    
  3.    cin >> birthMonth;
  4.    cin >> birthYear;
  5.    
  6.    cout << birthMonth << "/" << birthYear;

Explanation:

Firstly, we declare two integer type variables, birthMonth and birthYear (Line 1).  Next, we use cin as the standard input stream to get the birth month and year from user (Line 3 - 4). Finally, we print the date using cout. We can chain the << operator to create a date string with format birthMonth/birthYear as expected by question (Line 6)