Write a program that reads in and sums the squares of positive integers until a value that 0 or less is read in.
What will be an ideal response?
```
// file ch2nu36.cc
// test question 36 for chapter 2
>>Delete above comment
#include
using namespace std;
//loop to accept positive integers until nonnegative
//integer, then return sum
int main()
{
int x = 1, i = 0, sum = 0;
cout << "Enter positive integers, followed by
<< " 0 or negative stops." << endl
<< " I will give the sum." << endl;
while ( x > 0 )
{
cout << "Enter integer " << i << ": ";
cin >> x;
sum = sum + x;
i++;
}
cout << "sum: " << sum << endl;
return 0;
}
```
You might also like to view...
The _________ technique is used on a Windows server to optimize the use of threads.
A) ?polling ? B) ?asynchronous procedure call C) ?signaling an event object ? D) ?I/O completion ports
What does the following program do?
```
// Printing.cpp
#include
This type of boot occurs when the computer is already on and you restart it without turning off the power.
A. cold boot B. warm boot C. generic boot D. live boot
To quit Word, click the Restore button on the right side of the title bar.
Answer the following statement true (T) or false (F)