Write a program of switch case of day :)))
1)
#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{
int ch;
clrscr();
while(1)
{
cout<<"\n\n Enter the Number (between 1 to 8): \n ";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\n Sunday";
break;
case 2:
cout<<"\n Monday";
break;
case 3:
cout<<"\n Tuesday";
break;
case 4:
cout<<"\n Wednesday";
break;
case 5:
cout<<"\n Thursday";
break;
case 6:
cout<<"\n Friday";
break;
case 7:
cout<<"\n Saturday";
break;
default:
exit(0);
}
}
getch();
}
2)
#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{
int ch;
clrscr();
D:
{
cout<<"\n\n Enter the Number (between 1 to 8): \n ";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\n Sunday";
goto D;
case 2:
cout<<"\n Monday";
goto D;
case 3:
cout<<"\n Tuesday";
goto D;
case 4:
cout<<"\n Wednesday";
goto D;
case 5:
cout<<"\n Thursday";
goto D;
case 6:
cout<<"\n Friday";
goto D;
case 7:
cout<<"\n Saturday";
goto D;
default:
exit(0);
}
}
getch();
}
Here is the output :))
No comments:
Post a Comment