Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions