Chapter 4: Problem 26
State whether the following are valid switch statements. If not, explain why.
Assume that \(n\) and digit are int variables.
a. switch \((n<=2)\) \\{
case 0:
cout \(<<\) "Draw." \(<<\) endl break; case 1:
cout \(<<\) "Win. " \(<<\) endl break; case 2:
cout \(<<\) "Lose." \(<<\) endl break; \\}
b. switch (digit / 4 ) \\{
case 0 case 1:
cout \(<<\) "Iow. " \(<<\) endl break; case 1 case 2:
cout \(<<\) "middle." \(<<\) endl break; case 3:
cout \(<<\) "high." \(<<\) endl
c. switch
\((n \quad \text { \& } \quad 6)\)
\\{
case 1:
case 2:
case 3:
case 4:
case 5:
cout \(<
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.