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
Explain Http and Ftp​
larisa86 [58]

Answer:

***HTTP is a protocol which allows the fetching of resources, such as HTML documents. It is the foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browse.

**ftp or File Transfer Protocol is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. FTP is built on a client–server model architecture using separate control and data connections between the client and the server.

4 0
2 years ago
Why don’t the ads on Brainly load anymore
vovikov84 [41]
Umm I really have no idea
7 0
2 years ago
Read 2 more answers
Why does Brainly not have a astronomy section. (I'd prefer brainly answer this)
elena55 [62]
Could you by any chance help me with my business work?! Please go to my profile and go to the questions that have the subject business!
6 0
3 years ago
The average numbers of shares a piece of content receives is known as its:
tino4ka555 [31]

Answer:

Amplification.

Explanation:

Social media publishing can be defined as a service that avails end users the ability to create or upload web contents in either textual, audio or video format in order to make them appealing to a target audience.

Thus, these web contents are generally accessed by end users from time to time through the use of various network-based devices. As users access these contents, they're presented with the option of sharing a particular content with several other people a number of times without any form of limitation.

Hence, the average numbers of shares a piece of content receives is known as its amplification. The higher the average numbers of shares a particular content receives, the higher the number of traffic it generates for its publisher.

3 0
3 years ago
If you feel your friend had a negative digital identity, what would you do or tell them in order to help them have a positive di
sladkih [1.3K]
Have them post more positive outcomes and help them understand that what they post stays there forever
4 0
3 years ago
Read 2 more answers
Other questions:
  • Prompt the user for a string that contains two strings separated by a comma. (1 pt)Examples of strings that can be accepted:Jill
    5·1 answer
  • A. True
    14·2 answers
  • Write a function decimalToBinaryRecursive that converts a decimal value to binary using recursion. This function takes a single
    11·1 answer
  • I just started game development using unity, I’m trying to control my sphere moving on a flat surface using the W,A,S,D keys, if
    5·1 answer
  • All of the following are vertical alignment options except __middle , top, center, or_bottom_.
    12·1 answer
  • A bank uses a computer program during the night to tell if the alarm should ring. Sensors in the bank set the following Boolean
    5·1 answer
  • Help a brotha out..................
    10·1 answer
  • If String str = "Computer Science";, then what is the value of str.substring(10);? ​
    6·1 answer
  • Which of these is most likely to contribute to the long term of a local ecosystem?
    5·1 answer
  • Describe the concept behind a digital signature and explain how it relates to cybersecurity by providing a hypothetical example
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!