Chapter 5: Problem 13
A(n) __________ is a special value that marks the end of a series of values.
Chapter 5: Problem 13
A(n) __________ is a special value that marks the end of a series of values.
All the tools & learning materials you need for study success - in one app.
Get started for freeinclude
\(<\) iostream \(>\) using namespace std; int main ( ) \(\\{\) int num, bigNum,
power, count; cout \(<<\) "…
#
A) // This program uses a loop to raise a number to a power. # include \(<\)
iostream \(>\) using namespace std; int main ( )
\(\\{\) int num, bigNum, power, count;
cout \(<<\) "Enter an integer: "; \(\operatorname{cin} \quad>>\) num
cout \(<<\) "What power do you want it raised to? "; cin \(>>\) power bigNum \(=\)
num; while (count++ \(<\) power); bigNum \(*=\) num; cout \(<<\) "The result is \(<<\)
bigNum \(<<\) endl return 0
\\}
B) // This program averages a set of numbers. # include
To __________ a value means to decrease it by one.
Rewrite the following code, converting the while loop to a do-while loop: char doAgain \(=' y^{\prime}\) \\[ \text { int } \operatorname{sum}=0 \\] cout \( < < \) "This code will increment sum 1 or more times. \(| n "\) while ( (doAgain = = ' y') | | (doAgain = = 'Y') ) \(\\{\quad s u m++;\) cout \( < < \) "Sum has been incremented. Increment it again(y/n)? "; cin \(>>\) doAgain; \\} cout \( < < \) "Sum was incremented " \( < < \) sum \( < < "\) times. \(\backslash n "\)
Each repetition of a loop is known as a(n) __________.
Write code that lets the user enter a number. The number should be multiplied by 2 and printed until the number exceeds \(50 .\) Use a while loop.
What do you think about this solution?
We value your feedback to improve our textbook solutions.