Answer to Question #99423 in C++ for Caleb

Question #99423
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.
#include <iostream>
using namespace std;

int main() {
char origLetter;

cin >> origLetter;

/* Your solution goes here */

return 0;
}
1
Expert's answer
2019-12-09T14:04:28-0500

switch(origLetter) {

case 'a':

cout << "Alpha" << endl;

break;

case 'A':

cout << "Alpha" << endl;

break;

case 'b':

cout << "Beta" << endl;

break;

case 'B':

cout << "Beta" << endl;

break;

default:

cout << "Unknown" << endl;

break;

}


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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS