
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Edition 8ISBN: 978-1285867410
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Edition 8ISBN: 978-1285867410 Exercise 2
Using a switch Statement
In this exercise, you use what you have learned about the switch statement to study some C++ code, and then answer Questions.
First, examine the following code:
int numValue = 10;int answer = 0;switch(numValue){case 5: answer += 5;case 10: answer += 10;case 15: answer += 15;break;case 20: answer += 20;case 25: answer += 25;default: answer = 0;break;}cout ? "Answer: " ? answer ? endl;
What is the value of answer if the value of numValue is 17?
In this exercise, you use what you have learned about the switch statement to study some C++ code, and then answer Questions.
First, examine the following code:
int numValue = 10;int answer = 0;switch(numValue){case 5: answer += 5;case 10: answer += 10;case 15: answer += 15;break;case 20: answer += 20;case 25: answer += 25;default: answer = 0;break;}cout ? "Answer: " ? answer ? endl;
What is the value of answer if the value of numValue is 17?
Explanation
The "switch" statement is same like a ne...
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Why don’t you like this exercise?
Other Minimum 8 character and maximum 255 character
Character 255