Answer to Question #136151 in C++ for alisha

Question #136151
Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a slash, and the year. End with newline.
1
Expert's answer
2020-10-01T14:50:13-0400
#include <iostream>
using namespace std;

int main()
{
    int birth_month=0, birth_year=0;
    
    cout << "Enter date of birth:DD ";
    cin >> birth_month;
    cin >> birth_year;
    if(birth_month>0){
        if(birth_month<13){
            if(birth_year>0){
cout << "The required date is:" << birth_month << "/" << birth_year;             }else{
    cout << "Please enter the valid year";
                }
        }else{
            cout << "Please enter the valid month";
        }
    }else{
        
            cout << "Please enter the valid month";
        }
        
        
   
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS