Friday 2 May 2014

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).

Leave a Comment


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;


If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: