Question: C++ please An application of the floor) function is rounding a value to a specific decimal point. The statement yfloor(x 0.5) rounds the variable x
An application of the floor) function is rounding a value to a specific decimal point. The statement yfloor(x 0.5) rounds the variable x to the nearest integer and assigns the result to y. The statement y floor (x10.0 0.5)/10.0; rounds the variable x to the tenths place and assigns the result to y. The statement yfloor(x100.0 0.5)/100.0 rounds the variable x to the hundredths place and assigns the result to y. Write a program that defines four functions to round a variable x various ways with the following function prototypes: a) int roundToInteger (double x); b) double roundToTenths (double x); c) double roundToHundredths (double x) d) double hs (double x); Use these functions to round the average of a sequence of numbers to the proper decimal point Specifications: Prompt the user to enter the number of values to be averaged. Use this value to create a for) loop to read in a sequence of numbers. Calculate the average of the numbers, and pass the average into each of the functions to round the value to the required decimal points. Print the results to the screen with4 values after the decimal point, as necessary. As an example, if you execute the program with the following underlined inputs, the output will be: -main.o Enter Number of Values to be Averaged: 3 Enter a number: 1.299999 Enter a number: 4.5321 Enter a number: -2.3 The raw average is: ...to the nearest integer: 1 ...to the tenths place: ...to the hundredths place: 1.1800 1.1774 1.2000 ...to the thousandths place: 1.1770 Develop your I'O diagram and pseudocode, debug your code, and submit to the Grader Program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
