QUESTION IMAGE
Question
organize the lines of code to create a switch statement that checks origletter.
if the input is a or a, then the output is: alpha
if the input is b or b, then the output is: beta
for any other input, the output is: unknown
how to use this tool
unused
switch (origletter) {
cout << \unknown\ << endl;
break;
cout << \beta\ << endl;
break;
cout << \alpha\ << endl;
break;
case a:
case a:
default:
case b:
}
case b:
main.cpp
load default template...
#include <iostream>
using namespace std;
int main() {
char origletter;
cin >> origletter;
return 0;
}
Step1: Insert switch header
switch (origLetter) {
Step2: Add 'A' case
case 'A':
Step3: Add 'a' case
case 'a':
Step4: Add Alpha output
cout << "Alpha" << endl;
break;
Step5: Add 'B' case
case 'B':
Step6: Add 'b' case
case 'b':
Step7: Add Beta output
cout << "Beta" << endl;
break;
Step8: Add default case
default:
Step9: Add Unknown output
cout << "Unknown" << endl;
break;
Step10: Close switch block
}Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
The completed main.cpp code is:
#include <iostream>
using namespace std;
int main() {
char origLetter;
cin >> origLetter;
switch (origLetter) {
case 'A':
case 'a':
cout << "Alpha" << endl;
break;
case 'B':
case 'b':
cout << "Beta" << endl;
break;
default:
cout << "Unknown" << endl;
break;
}
return 0;
}