whrite a program that input a number of week days and displays the name of the day for example if user 1 it disply friday and so on ( using switch statement)
Answers
Answered by
2
Explanation:
#include<iostream>
using namespace std;
int main()
{
int w;
cout<<"\t Name of the Day "<<endl;
cout<<"\n";
cout<<"Enter the Number of the Week's day"<<endl;
cin>>w;
switch(w)
{
case 1:
{
cout<<"The Day is Monday"<<endl;
break;
}
case 2:
{
cout<<"The Day is Tuesday"<<endl;
break;
}
case 3:
{
cout<<"The Day is Wednesday"<<endl;
break;
}
case 4:
{
cout<<"The Day is Thursday"<<endl;
break;
}
case 5:
{
cout<<"The Day is Friday"<<endl;
break;
}
case 6:
{
cout<<"The Day is Saturday"<<endl;
break;
}
case 7:
{
cout<<"The Day is Sunday"<<endl;
break;
}
default:
{
cout<<"Invalid Number. Please enter a valid number (From 1-7)";
}
}
}
Similar questions