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
PLEASEEEEEE HELP, ILL DO ANYTHING JUST ANSWER THESE CORRECTLY!!!!!TYSM!!!
REY [17]

10 minutes

Daguerreotype

Connect the cable between them

Shutters

A digital camera

Chemicals

Joseph Niepce

White

Copper

Camera Lenses

False

True

True

True

False

Thank you for taking photography class, I am doing the same class (FLVS SQUAD!!)

3 0
2 years ago
Read 2 more answers
A new product was introduced in 2003, which functions as both an identification device and a medium of communication. It uses in
Svetllana [295]

Answer:

nTag

Explanation:

nTag describe -Providing information on freight limitations-Preparing documentation-Packing exhibit materials-Helping to ensure that shipments arrive on time.

5 0
3 years ago
What will be returned when the following SQL statement is executed?
ycow [4]

Answer:

b) A listing of each driver as well as the number of deliveries that he or she has made

Explanation:

SQL which stands for Structured Query Language. and an SQL statements are used in performing tasks such as to update data on a database, or retrieve data from a database. Some of the popular relational database management systems that use SQL are: Sybase, Oracle, Microsoft SQL Server, Ingres, Access, etc.

3 0
3 years ago
Read 2 more answers
I forgot to tell it’s on Roblox for those who play and wanted to be friends and new ppl username is mosarider489
never [62]

Answer:.

Explanation:

.

8 0
3 years ago
Read 2 more answers
Typically, a programmer develops a programâs logic, writes the code, and ____ the program, receiving a list of syntax errors.
miv72 [106K]
"debugs" is the answer
4 0
3 years ago
Other questions:
  • Stefan is finalizing his presentation by adding media files and preparing it for distribution. Stefan knows that saving a presen
    13·1 answer
  • What do you click on to minimize all open windows? the Show Desktop icon the Start menu the system tray the taskbar
    15·2 answers
  • You are working in the media industry, and you have created a web application where users will be able to upload photos they cre
    5·2 answers
  • Sulfur content is measured in
    11·1 answer
  • In UNIX, how do I set the permissions on MyProgram.py to: rwx---r-x?
    7·1 answer
  • How to create a distribution list in outlook?
    7·1 answer
  • Fill in the blanks Pasaline could ----- and ------- very easily.​
    8·1 answer
  • In a paragraph, describe in detail a practical real-world example of where you would implement a singly-linked list and why a si
    8·1 answer
  • Stroke weight - ____ of the line around a shape or size of the point
    8·1 answer
  • Who designed the apple i computer in 1976?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!