Chapter 4: Problem 29
Suppose that num is an int variable. Consider the following \(\mathrm{C}++\) code: cin \(>>\) num; if \((\mathrm{num}>=0)\) switch (num) \\[ \\{ \\] case 0: \\[ \text { num }=\operatorname{static}_{-} \text {cast }\langle\text { int }(\text { pow }(\text { num, } 3.0)) \\] break; case 2: num \(=++\) num break; case 4: num \(=\) num -4 break; case 5: \\[ \text { num }=\operatorname{num} * 4 \\] case 6: \\[ \text { num }=\operatorname{num} / 6 \\] break ; case 10: num- break default: num \(=-20\) \\} else num \(=\) num +10 a. What is the output if the input is \(5 ?\) b. What is the output if the input is 26 ? c. What is the output if the input is 2 ? d. What is the output if the input is \(-5 ?\)
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.