Question: c++ Use cin to read double amountReserved from input. Then, read the remaining doubles from input until 100.0 is read. For each non-positive double read

c++

Use cin to read double amountReserved from input. Then, read the remaining doubles from input until 100.0 is read. For each non-positive double read before 100.0, output the double followed by " error". End each output with a newline. Lastly, subtract all the positive doubles from amountReserved.

Ex: If the input is 51.5 -9.5 8.5 8.0 4.0 100.0, then the output is:

-9.5 error The total after subtracting all positive values is 31

Note: amountReserved may go negative.

#include using namespace std;

int main() { double inputNumber; double amountReserved;

/* Your code goes here */

cout << "The total after subtracting all positive values is " << amountReserved << endl;

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!