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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started