C++, Programmimg Languages

Write a program in C++ to print month of year using Switch statement

#include<iostream.h>

#include<conio.h>

void main()

{

int a;

clrscr();

cout<<“Enter the value b/w 1 to 1è”;

cin>>a;

switch(a)

{

case 1:

cout<<“January “;

break;

case 2:

cout<<“February “;

break;

case 3:

cout<<“March”;

break;

case 4:

cout<<“April “;

break;

case 5:

cout<<“May”;

break;

case 6:

cout<<“June”;

break;

case 6:

cout<<“July “;

break;

case 8:

cout<<“August”;

break;

case 9:

cout<<“September”;

break;

case 10:

cout<<“October”;

break;

case 11:

cout<<“November”;

break;

case 12:

cout<<“December”;

break;

}

getch();

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s