I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.
#include <iostream>
using namespace std;
int main()
{
int weeknumber;
//Reading week no from user
cout<<"Enter week number(1-7): ";
cin>>weeknumber;
switch(weeknumber)
{
case 1: cout<<"Monday";
break;
case 2: cout<<"Tuesday";
break;
case 3: cout<<"Wednesday";
break;
case 4: cout<<"Thursday";
break;
case 5: cout<<"Friday";
break;
case 6: cout<<"Saturday";
break;
case 7: cout<<"Sunday";
break;
default: cout<<"Invalid input! Please enter week no. between 1-7.";
}
return 0;
}
I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.
Result:
Enter week number(1-7): 5
Friday
need an explanation for this answer? contact us directly to get an explanation for this answer