Write a switch statement that checks origLetter. If \'a\' or \'A\', print \"Alph
ID: 3562266 • Letter: W
Question
Write a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print "Beta". For any other character, print "Unknown". Use fall-through as appropriate. End with newline.
Sample program:
Below, do not type an entire program. Only type the portion indicated by the above instructions (and if a sample program is shown above, only type the <STUDENT CODE> portion.)
i feel like i have an idea on how to do this but im still really confused. can someone please show me how to do this?
Explanation / Answer
// End with newline.
switch(origLetter)
{
case 'a' :
case 'A':
cout<<"alpha"<<endl;
break;
case 'b':
case 'B':
cout<<"beta"<<endl;
break;
default:
cout<<"not valid expression"<<endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.