Question: Using c++ Exercise 2: Mathematical Operations (with floating point) Create a new file lab01 ex2.cpp for this exercise. The program will sum six numbers provided

Using c++
 Using c++ Exercise 2: Mathematical Operations (with floating point) Create a

Exercise 2: Mathematical Operations (with floating point) Create a new file lab01 ex2.cpp for this exercise. The program will sum six numbers provided as input by the user, and then output the sum and the average of the numbers. Your Program You have 6 measurements (what data type will you use to hold measurements?) from a scientific experiment, and you need the sum and the average of these measurements. Write a program to take in the six numbers from the standard input (cin) with the input operator (">>"), and sum them. Then divide by the number of values (6) to get the average. Output the sum and the average. Notice that even though we divided the sum (which is a floating point number) by the count (an integer), the resulting average is floating point: when you mix the two type in an arithmetic expression, floating point (the more "precise" type) "wins". Example: If your 6 numbers are 1.5, 2.1, 3.8, 4.2, 5.7, 6.1 Your output should look like this (user input is bolded and underlined): Enter six fp numbers on a single line, separated by spaces: 1.5 2.1 3.8 4.25.76.1 Sum of 1.5 2.13.8 4.25.7 6.1 23.4 Average 3.9

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!