Write a program take
the number of a month as an input from the user, and determine which month it
is. Means if user enter 2 ; then it should print “it is month of February” . .
(using switch statement).
#include <iostream>
using namespace std;
int main()
{
int c;
cout<<"Enter a month number:";
cin>>c;
switch(c)
{
case 1:
cout<<"It's is January";
break;
case 2:
cout<<"It's is February";
break;
case 3:
cout<<"It's is March";
break;
case 4:
cout<<"It's is april";
break;
case 5:
cout<<"It's is May";
break;
case 6:
cout<<"It's is June";
break;
case 7:
cout<<"It's is July";
break;
case 8:
cout<<"It's is Augest";
break;
case 9:
cout<<"It's is September";
break;
case 10:
cout<<"It's is Octobar";
break;
case 11:
cout<<"It's is November";
break;
case 12:
cout<<"It's is Decamber";
break;
default:
cout<<"you enter invaild number";
}
return 0;
}
using namespace std;
int main()
{
int c;
cout<<"Enter a month number:";
cin>>c;
switch(c)
{
case 1:
cout<<"It's is January";
break;
case 2:
cout<<"It's is February";
break;
case 3:
cout<<"It's is March";
break;
case 4:
cout<<"It's is april";
break;
case 5:
cout<<"It's is May";
break;
case 6:
cout<<"It's is June";
break;
case 7:
cout<<"It's is July";
break;
case 8:
cout<<"It's is Augest";
break;
case 9:
cout<<"It's is September";
break;
case 10:
cout<<"It's is Octobar";
break;
case 11:
cout<<"It's is November";
break;
case 12:
cout<<"It's is Decamber";
break;
default:
cout<<"you enter invaild number";
}
return 0;
}
0 Questions:
Post a Comment