Answer to Question #270574 in C++ for Jaffar

Question #270574

CREATE A C++ PROGRAM THAT DIPLSYS THE NAME OF THE MONTH IN A YEAR BASED ON THE NUMBER ENTERED VIA THE KEYBOARD USING IF/ELSE IF


1
Expert's answer
2021-11-23T11:22:55-0500
#include<iostream>
using namespace std;
int main()
{
	int n;
	cout<<"Enter a number of the month: ";
	cin>>n;
	if(n==1){
		cout<<"January";
	}
	else if(n==2){
		cout<<"February";
	}
	else if(n==3){
		cout<<"March";
	}
	else if(n==4){
		cout<<"April";
	}
	else if(n==5){
		cout<<"May";
	}
	else if(n==6){
		cout<<"June";
	}
	else if(n==7){
		cout<<"July";
	}
	else if(n==8){
		cout<<"August";
	}
	else if(n==9){
		cout<<"September";
	}
	else if(n==10){
		cout<<"October";
	}
	else if(n==11){
		cout<<"November";
	}
	else if(n==12){
		cout<<"December";
	}
	else{
		cout<<"Invalid number of the month";
	}
}

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