What is wrong with the following switch statement?
Int ans;
Cout <<"Type y for yes on n for no\n";
Cin >> ans;
Switch ans)
{
Case 'y':
Case 'Y': cout << "You said yes\n"; break;
Case 'n':
Case 'N': cout << "You said no\n"; break;
Default: cout <<"invalid answer\n";
}
A) ans is a int
B) break; is illegal syntax
C) nothing
D) there are no break statements on 2 cases.
Correct Answer:
Verified
Q23: What is the output of the following
Q24: Given the following code, what is the
Q25: Which of the following symbols has the
Q26: Given the following enumerated data type definition,
Q27: What is the output of the following
Q29: Given the following enumerated data type definition,
Q30: Which of the following boolean expressions tests
Q31: Which boolean operation is described by the
Q32: What is the value of x after
Q33: What is the output of the following
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents