(Numerical) a. The following is an extremely useful
Step 1: Multiply the number by
Step 2: Add 0.5
Step 3: Delete the fractional part of the result
Step 4: Divide by
For example, using this algorithm to round the number 78.374625 to three decimal places yields:
Using this algorithm, write a C++ function that accepts a user-entered value and returns the result rounded to two decimal places.
b. Enter, compile, and run the program written for Exercise 11a.
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
C++ for Engineers and Scientists
- Write the complete code for the problem as given belowarrow_forwardState whether each of the following is true or false. If false, explain why j) The arithmetic operators *, /, %, + and - all have the same level of precedence.arrow_forwardc) It is desired to compute the some of the first 10 terms of the series 14k3 -20k2 +5k, k= 1, 2, 3 Write a MATLAB program that can calculate the sum d) Write a MATLAB program that determine the number of elements in all Numbers bigger than 100arrow_forward
- (Practice) Run Program 7.10 to determine the average and standard deviation of the following list of 15 grades: 68, 72, 78, 69, 85, 98, 95, 75, 77, 82, 84, 91, 89, 65, and 74.arrow_forwardwhat are the output of the following segment of C++ code. Answer only fourarrow_forwardRewrite the following statements using augmented assignment operators.a. x = x + 1b. x = x * 2c. x = x / 10d. x = x − 100arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning