C++ PLEASE pay attention to the extra instructions below (I am struggling with the floor function): Programming Challenge: 12 - Celsius to Fahrenheit table Have the user input the start and stop temperatures for the table as floating-point values. The values can be entered in any order. The lower of the two temperatures will be the start value, and the higher temperature will be the stop value. Take the start value down to the next lower integer. For example, if the start value is 12.9 make the start value equal to 12 instead. This operation is called the "floor" of 12.9. The floor of a floating-point number is the largest integer that is not larger than that number. Note: the floor of 12 (an integer) is still 12. Take the stop value up to the next higher integer. For example, if the stop value is 24.1 take it up to 25. This operation is called the "ceiling" of 24.1. The ceiling of a floating-point number is the smallest integer that is not smaller than that number. The ceiling of 25 (an integer) is still 25. The cmath library contains functions floor() and ceil() that will do the math for you. So if you want to compute and store the (integer) value of the floor of x, write something like int floor_x = floor(x); The table will run from start to stop (in Celsius) in 1-degree increments. The table should show the values right-justified in columns, with the Celsius values shown as integers (no decimal point) in the left-hand column and with the Fahrenheit values displayed with two digits after the decimal point in the right-hand column. For your screen shot, enter temperatures of 14.1 and -9.5 degrees, in that order. This should produce a table from -10 to 15 degrees.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
C++ PLEASE pay attention to the extra instructions below (I am struggling with the floor function):
Have the user input the start and stop temperatures for the table as floating-point values. The values can be entered in any order. The lower of the two temperatures will be the start value, and the higher temperature will be the stop value.
Take the start value down to the next lower integer. For example, if the start value is 12.9 make the start value equal to 12 instead. This operation is called the "floor" of 12.9. The floor of a floating-point number is the largest integer that is not larger than that number. Note: the floor of 12 (an integer) is still 12.
Take the stop value up to the next higher integer. For example, if the stop value is 24.1 take it up to 25. This operation is called the "ceiling" of 24.1. The ceiling of a floating-point number is the smallest integer that is not smaller than that number. The ceiling of 25 (an integer) is still 25.
The cmath library contains functions floor() and ceil() that will do the math for you. So if you want to compute and store the (integer) value of the floor of x, write something like
int floor_x = floor(x);
The table will run from start to stop (in Celsius) in 1-degree increments. The table should show the values right-justified in columns, with the Celsius values shown as integers (no decimal point) in the left-hand column and with the Fahrenheit values displayed with two digits after the decimal point in the right-hand column.
For your screen shot, enter temperatures of 14.1 and -9.5 degrees, in that order. This should produce a table from -10 to 15 degrees.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images