Rewrite the following using a switch statement. Code and submit the program (inc
ID: 3640018 • Letter: R
Question
Rewrite the following using a switch statement.Code and submit the program (including at least 2 outputs) to the Wk10_Assign3 DropBox
#include<iostream.h>
int main ( )
{
char marcode;
cout<< “Enter a time of day code: “;
cin >> timeofday;
if (timeofday = = ‘M’)
cout << “Good Morning!” << endl;
else if (timeofday = = ‘A’)
cout << “Good Afternoon” << endl;
else if (timeofday = = ‘E’)
cout <<”Good Evening” << endl;
else if (timeofday = = ‘N’)
cout << Good Night” << endl;
else
cout << “An invalid code has been entered. Please Try Again!!”
return 0;
}
Explanation / Answer
#include int main ( ) { char marcode; cout> timeofday; switch(marcode) { case M : coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.