Tuesday 29 March 2016

Program to print the days of weeks by using switch case in c++ language.

//WAP to print the days of weeks by using switch case.
 
#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();

int c;
cout<<"enter any case";
cin>>c;
switch(c)
{
case 1:
cout<<"monday"<<endl;
break;
case 2:
cout<<"tuesday"<<endl;
break;
case 3:
cout<<"wednesday"<<endl;
break;
case 4:
cout<<"thrusday"<<endl;
break;
case 5:
cout<<"friday"<<endl;
break;
case 6:
cout<<"saturday"<<endl;
break;
default:
cout<<"error"<<endl;
break;
}
getch();
}

Output:-
               

No comments:

Post a Comment