Solution Review: Display Day of the Week
Let's see the detailed solution review of the challenge given in the previous lesson.
We'll cover the following...
Solution
Run the code below and see the output!
C++
#include <iostream>using namespace std;int main() {// Initialize variable numberint number = 3;// switch blockswitch (number) {// first casecase 1:cout << "Monday";break;// second casecase 2:cout << "Tuesday";break;// third casecase 3:cout << "Wednesday";break;// fourth casecase 4:cout << "Thursday";break;// fifth casecase 5:cout << "Friday";break;// sixth casecase 6:cout << "Saturday";break;// seventh casecase 7:cout << "Sunday";break;// default casedefault:cout << "Invalid input";}return 0;}
...