Case 1: Input: 5.1, 5.1, 5.1, 5.1, 5.1. Expected Output: 26.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question
100%

Write a program that prompts the user to input five decimal numbers. The program should then add the
five decimal numbers, convert the sum to the nearest integer, and print the result. Use the static_cast
statement with an appropriate equation to convert the sum to an integer. Compile and run your
program with the following test data:
Case 1: Input: 5.1, 5.1, 5.1, 5.1, 5.1. Expected Output: 26.
Case 2: Input: 5.0, 5.0, 5.0, 5.0, 5.0. Expected Output: 25.

 

The language is C++

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning