Question: give me steps. Write a program called truncate.cpp that accepts an arbitrary floating point value from standard input and returns the value truncated to the
give me steps.
Write a program called truncate.cpp that accepts an arbitrary floating point value from standard input and returns the value truncated to the second position after the decimal (the hundredths place). The value needs to be printed to the screen according to the following format:
Sample out below
The truncated value is v.
The variable v needs to be substituted for the corresponding value. You may not use any library function or conditionals to compute the value. Instead, you must use simple multiplications, divisions, additions, and/or subtractions as well as type casts to calculate the truncated value and then print it to the screen. In the output, ensure that only two digits after the decimal point are shown in the output of v. For example, if you enter 3.768, the output should show the value 3.76.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
