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:

// here is code in the C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

// variable to store the input

int birth_month,birth_year;

cout<<"enter birth month:";

// read the birth month

cin>>birth_month;

cout<<"enter birth year:";

// read the birth year

cin>>birth_year;

// print the output

cout<<birth_month<<"/"<<birth_year<<endl;

return 0;

}

Explanation:

Declare two variables to store the birth month and birth year.Read the inputs from the user and assign it the variables.Print the birth month and year separated by a slash "/".

Output:

enter birth month:1                                                                                                        

enter birth year:2000                                                                                                      

1/2000