Create a program that will make ask the user to input an integer then display the equivalent day of the week. 1 is Sunday, 2 is Monday and so on. If the inputted number is not within 1-7m output is ''Day is not available!''.
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter day of the week: ";
cin >> n;
switch (n)
{
case 1:
cout << "Monday\n";
break;
case 2:
cout << "Tuesday\n";
break;
case 3:
cout << "Wednesday\n";
break;
case 4:
cout << "Thursday\n";
break;
case 5:
cout << "Friday\n";
break;
case 6:
cout << "Saturday\n";
break;
case 7:
cout << "Sunday\n";
break;
default:
cout << "Day is not available!\n";
break;
}
return 0;
}
Comments
Leave a comment