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
Describe shortly about the following Linux directories and theirpurpose,1. lib2. etc3. Boot4. Root5. home
Bingel [31]

Answer:

 Linux directories and their purposes are:

1) lib - Lib file contained the share object library file which necessary to boots system and this directory contain file module stored in the kernel.

2) etc - etc file is the configuration file that they are local in the machines. When the program run these file are stored in the directories. this can be static and do not executable directory.

3) Boot - Boot file are stored in the directory which required processing of linux boot and such files are included in the linux kernel of the file.

4) Root - Root file are the best user root directory and user cannot view this directories from there account. This file usually contain administrative file system.  

5) Home - Home file contained the user directory and it is the default system of linux. Home directory helps user to enable any network system to access there home directories.

5 0
2 years ago
WILL GIVE A BRAINLIEST!!! PLS HELP!!!
DIA [1.3K]

Answer:

never gonna give you uppp

Explanation:

criiiiii

7 0
3 years ago
What are the four different orchestral instrument families?
natka813 [3]

Answer:

Gutair

Violen

cello

Double Brass

Harp

Explanation:

7 0
3 years ago
Read 2 more answers
All of the following are types of data storage devices except CD/DVD computer monitor digital cameras flash drive
horrorfan [7]

Computer Monitors are not storage devices.

3 0
3 years ago
Which option describes wearable technology? A. the incorporation of technology into objects we use regularly B. rugged technolog
vichka [17]

The correct answer is

A.  the incorporation of technology into objects we use regularly

#Platogang

8 0
3 years ago
Other questions:
  • Five computers are connected to a switch in a star topology. what type of network is this?
    12·1 answer
  • When was unicode invented?
    13·1 answer
  • The Fibonacci numbers are the numbers
    15·1 answer
  • Between Handshake protocol, change cipher suite, alert and appplication data protocols, the first one to use is:
    13·1 answer
  • Which of the following statements is true?
    9·1 answer
  • It is not important to keep financial records since they can all be found online.
    5·2 answers
  • How to create an app on app store please its not a joke, if someone knows tell me how
    15·1 answer
  • How does abstraction help us write programs
    11·1 answer
  • You and a friend have just started a small business. How could you use the Internet to make your business successful?
    15·2 answers
  • Write a pseudocode to calculate the volume of a cylinder​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!