Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Output each floating - point value with two digits after the decimal point, which can be achieved by executing cout fixed setprecision ( 2 )

Output each floating-point value with two digits after the decimal point, which can be achieved by executing
cout fixed setprecision(2); once before all other cout statements.
(1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in a vector of doubles. Output the vector's numbers on one line, each number followed by one space. (2 pts)
Ex:
Enter weight 1:
236.0
Enter weight 2:
89.5
Enter weight 3:
142.0
Enter weight 4:
166.3
Enter weight 5:
93.0
You entered: 236.0089.50142.00166.3093.00
(2) Also output the total weight, by summing the vector's elements. (1 pt)
(3) Also output the average of the vector's elements. (1 pt)
(4) Also output the max vector element. (2 pts)
Ex:
Enter weight 1:
236.0
Enter weight 2:
89.5
Enter weight 3:
142.0
Enter weight 4:
166.3
Enter weight 5:
93.0
You entered: 236.0089.50142.00166.3093.00
Total weight: 726.80
Average weight: 145.36
Max weight: 236.0089.5
Enter weight 3:
142.0
Enter weight 4:
166.3
Enter weight 5:
93.0
You entered: 236.00,89.50,142.00,166.30,93.00
(2) Also output the total weight, by summing the vector's elements. (1 pt)
(3) Also output the average of the vector's elements. (1 pt)
(4) Also output the max vector element. (2 pts)
Ex:
Enter weight 1:
236.0
Enter weight 2:
89.5
Enter weight 3:
142.0
Enter weight 4 :
166.3
Enter weight 5:
93.0
You entered: 236.00,89.50,142.00,166.30,93.00
Total weight: 726.80
Average weight: 145.36
Max weight: 236.00
image text in transcribed

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 1 Lnai 9851

Authors: Paolo Frasconi ,Niels Landwehr ,Giuseppe Manco ,Jilles Vreeken

1st Edition

3319461273, 978-3319461274

More Books

Students also viewed these Databases questions

Question

=+5. What does this public need on this issue?

Answered: 1 week ago