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
Sliva [168]
3 years ago
6

Write a program that requires the user to enter two floating-point numbers (num1 and num2) from the keyboard. Multiply them and

display the original two numbers and the calculated floating-point product. When displaying the floating-point numbers, limit your output display to 3 digits after the decimal point (for example, display 23.567810 as 23.568).
Computers and Technology
1 answer:
kogti [31]3 years ago
5 0

Answer:

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

   float num1,num2,product;

   cout<<"Input first number: ";

   cin>>num1;

   cout<<"Input second number: ";

   cin>>num2;

   product = num1*num2;

   int digits = 3;

  cout << " (rounded to " << digits << " digits after the decimal point )"<< fixed << setprecision(digits) << num1 << "*" << num2 <<  " = " << product << "\n";

   

   return 0;

}

Explanation:

iostream is a standard library file that contains code that allows a C++ program to display output on the screen and read input from the keyboard.

iomanip is a standard library used for formatting your output.

using namespace std means that you are going to use classes or functions  from "std" namespace,

int main() is used as the entry point of the program, it contains your code and the  main() is the function from where the program will start to execute.

float num1,num2,product;

you have to first declare the variables and assign them to a data type float.

   cout<<"Input first number: ";

   cin>>num1;

   cout<<"Input second number: ";

   cin>>num2;

prompt and collect inputs for num1 and num2

product = num1*num2;

calculate the product of num1 and num2

int digits = 3;

the number of digits you want after the decimal point

cout << " (rounded to " << digits << " digits after the decimal point )"<< fixed << setprecision(digits) << num1 << "*" << num2 <<  " = " << product << "\n";

fixed ensures that the precision that you have set will remain constant through out the code.

setprecision(digits)  this allows you to set the precision

You might be interested in
Explain Importance of flowchart in computer programming
zhuklara [117]

Answer:

Flow charts help programmers develop the most efficient coding because they can clearly see where the data is going to end up. Flow charts help programmers figure out where a potential problem area is and helps them with debugging or cleaning up code that is not working.

creds to study.com (please don't copy it work by word, make sure to paraphrase it. otherwise plagiarism is in the game.)

Explanation:

7 0
2 years ago
How many years does it take in total to complete Bachelor’s, Master’s, and Phd in CS?
muminat

Answer:

3 years of study - Bachelor's degree

2 years of research - Master's degree

3 years of research to earn a PhD

So, On total it would take 8 years!

7 0
3 years ago
What term refers to a celebrity or other popular figure publicly supporting a product?
IgorLugansk [536]

Answer:

Endorsement

Explanation:

The term that refers to this is known as an Endorsement. This can be for any product or service and generally involves a celebrity or public figure that in one way or another relates to the product or service being advertised. One example of this would be famous soccer icon Christiano Ronaldo publicly supporting and appearing in Nike advertisements showing off their new soccer cleats.

3 0
3 years ago
Many web browsers include _____ tools to make it easier for designers to locate the source of a style that has been applied to a
larisa86 [58]

Answer:

Developer tools.

Explanation:

The main aim of developer tools to loading the HTML(hypertext markup language), CSS and JavaScript it describes how much time takes the page to load in the web browser.

The developer tools make the task easier for the designer to locate the source code which is applied to a specific page element.​We can easily see the source code of the particular website by using the Developer tools. So it makes the task easier for programmers and developers.

4 0
3 years ago
An important part of the development of transport is safety. how can you, when you get around in different ways, contribute to m
nika2105 [10]

Answer:

I need help I don't get a this questions please asap?

Explanation:    Head-on collisions. Some simple solutions can help to reduce the risk of head-on crashes. ...

   Run-off road crashes. This is when a vehicle collides with a stationary object, such as a sign or lamppost, after leaving the road. ...

   Intersection crashes. ...

   Vulnerable road users. ...

   Much work to be done.

Aug 31, 2018

8 0
3 years ago
Other questions:
  • If you think the user might enter 24.9, you should create a float variable. true or false
    9·1 answer
  • Pls help is very urgent and I will mark u as brainliest plsssss​
    11·2 answers
  • Many programmers today use a(n) _________, which is software that helps them build their computer programs. eula cad sdlc ide
    15·1 answer
  • The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected
    14·1 answer
  • A network administrator notices that some newly installed Ethernet cabling is carrying corrupt and distorted data signals. The n
    10·1 answer
  • In chapter 3, we discussed syntax and semantics, in general there are two types of grammars for programming languages, regular a
    14·1 answer
  • Which of these is system software? Check all
    14·1 answer
  • What is a photographic print made from a negative image?
    7·1 answer
  • WILL GIVE A BRAINLIEST!!! PLS HELP!!!
    5·1 answer
  • ____ uses a computer to design and test new products and modify existing ones. Computer-aided manufacturing Just-in-time design
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!