Lab 5 Problem Solution

$30.00 $24.00

Calculate a **running total** of positive integer values using a while loop and a boolean flag that will test for the condition of a **sentinel value**. – You will use the concept of a running total and sum up a series of inputed values together until the **sentinel value** of (-1) is entered. – Validate…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Calculate a **running total** of positive integer values using a while loop and a boolean flag that will test for the condition of a **sentinel value**.

– You will use the concept of a running total and sum up a series of inputed values together until the **sentinel value** of (-1) is entered.

– Validate that each inputed value is positive, otherwise have the user re-enter a positive value until valid.

– Once the sentinel value is entered, you will output the `max`, `min`, and `average` with precision up to 2 decimal places (remember not to include the sentinel value (-1) as an inputed value with your calculations).

– You will need to use the **iomanip** library for decimal precision (`setprecision` output modifier).

– You will also need a counter variable to count the number of values inputed.

Example Output

“`

Please enter an integer: 1 [entered]

Please enter an integer: 2 [entered]

Please enter an integer: 3 [entered]

Please enter an integer: -1[entered]

Min: 1

Max: 3

Total: 6

Avg: 2.00

“`

Lab 5 Problem Solution
$30.00 $24.00