Answer to Question #3327 in C++ for mukunda
Write a program to print the days in a week if 0=Sunday and 1=Monday and so on till Saturday by using switch-case.
1
2012-03-02T11:55:31-0500
#include<iostream>
using namespace std;
int main () {
int n;
cout << "Enter the number of the day in a week(0-6): ";
cin >> n;
switch(n){
case 0: cout << "Sunday"; break;
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;
}
return 0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment