1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Maslowich
3 years ago
5

Write a program that prompts the user to input five decimal numbers. The program should then add the five decimal numbers, conve

rt the sum to the nearest integer, and print the result.Use the static_caststatement 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
Computers and Technology
1 answer:
juin [17]3 years ago
6 0

Answer:

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

   double num1, num2, num3, num4, num5, sum = 0;

   cout << "Input: ";

   cin >> num1 >> num2 >> num3 >> num4 >> num5;

   

   sum = num1 + num2 + num3 + num4 + num5;

   cout << "Output: " << static_cast<int>(round(sum)) << endl;

   return 0;

}

Explanation:

Include cmath to use the round function

Declare the variables

Get the five numbers from the user

Sum them and assign the result to the sum

Round the sum using the round function, and convert the sum to an integer using static_cast statement

Print the sum

You might be interested in
A tornado destroyed many
m_a_m_a [10]

Answer:

D is your answer because I'm an expert

5 0
2 years ago
Read 2 more answers
The practice of texting is most popular and what age group
Diano4ka-milaya [45]
Mostly teenagers and young adults (ages 14-21) text the most.
4 0
3 years ago
Read 2 more answers
What is the shortcut key to launch the Macros dialog box?
Otrada [13]

Answer:

On excel, Ctrl + F8 is the shortcut for the Macros dialog box

Explanation:

7 0
3 years ago
How can the Internet help our country to be a leader in technology?
BigorU [14]

Answer:

it can help in the aspect of making technologies to be fastly operated with fast internet connection there by it top among all other countries

4 0
2 years ago
I have a question involving do and for loops while using arrays.
larisa86 [58]

Answer:

i just got my new pc

Explanation:

5 0
2 years ago
Other questions:
  • #TODO: Define a data structure to keep track of which links are part of / not part of the spanning tree.
    14·1 answer
  • Given a one dimensional array arr, what is the correct way ofgetting the number of elements in arr
    15·1 answer
  • 802.11ac provides an advantage over 802.11n by incorporating increased channel bonding capabilities. What size bonded channels d
    10·1 answer
  • Where (what memory location) is the data read from for the following code:
    12·1 answer
  • Leroy wants to keep the bride and groom in a picture, but remove the rest of the family. Which photo-editing tool should Leroy u
    14·1 answer
  • Read the following scenario. How might Sarah correct successfully complete her task?
    6·1 answer
  • ________ are the symbolic codes used in assembly language?​
    6·1 answer
  • In which generation microprocessor was developed short answer of computer science​
    7·1 answer
  • true or false? multimedia components such as audio and video do not significantly contribute to increased computer network traff
    15·1 answer
  • Why is it important to continiously conduct penetration testing for a strong security system?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!