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
Which item can be added to Outlook messages, like a Word document or PowerPoint presentation, that takes standard bulleted lists
Sonja [21]

Answer:

WordArt

Explanation:

Took exam

4 0
1 year ago
What is the relationship between interoperability and the other quality attributes highlighted in this book? For example, if two
Lina20 [59]

Answer:

Interoperability is the ability of or degree to which two or more systems usefully exchange information via interfaces in particular context. Interoperability can be defined in two ways which includes the ability to exchange data (syntactic interoperability) and also the ability to correctly interpret the data being exchanged (semantic interoperability).

If two systems failed to exchange information properly, it means they are not clear to interpret and not easy to communicate and get proper information from each other and that might result in a failed communication which is in turn result in security flaw.

Other quality attributes strongly related (at least potentially) to interoperability is Application Programming Interface (API)

API is a software intermediary that allows two applications to communicate to each other and are necessary for systems interoperability.

8 0
3 years ago
Which of the following is not considered a system component that can be found inside a computer? A-CPU B-RAM C-PCIe graphics ada
Julli [10]

The answer is C) PCIe graphics adapter, because it is not required for the computer to work.

8 0
2 years ago
which of the following peripheral does not belong to a group: A) Monitor B) Printer C) Hardware D) Keyboard​
nikdorinn [45]
C hardware is the correct answer
5 0
3 years ago
Match the careers with the education required for each job
Gekata [30.6K]
Statistician for the last one network administaror for the next one then animator then broadcast tech
6 0
3 years ago
Other questions:
  • 1. Create a view named customer_addresses that shows the shipping and billing addresses for each customer.
    15·1 answer
  • Certain medications can increase risk of obtaining a sunburn true or false
    12·1 answer
  • Magnetic ram (mram) uses ____ rather than an electrical charge to store data.
    6·1 answer
  • A very simple device that connects network components and sends packets of data to all other connected devices is called a _____
    5·1 answer
  • What was one of the first inventions that made it possible to communicate almost instantly?
    11·1 answer
  • Which of the following TCP/IP settings should be configured to specify DNS suffixes to use other than resolving names through a
    9·1 answer
  • Which federal agency enforces safety and health legislation and requires employers to be sure that adequate first-aid supplies a
    5·1 answer
  • Using direct mapping, consider a 16-bit memory addresses, and a cache with 64 blocks, where each block is 8 bytes. What is the s
    8·1 answer
  • Could anyone help me with this assignment please?
    6·1 answer
  • PLEASE ANSWER AND HURRY I'LL MARK YOU BRAINLIEST!!<br><br><br>​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!