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]
4 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]4 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
What is the computer's main memory, which consists of the random access memory (ram), cache memory, and read-only memory (rom) t
Nata [24]
Hey there!

The main memory of a computer that includes RAM, ROM, and cached information that is accessible through the CPU is called primary storage. These memory/storage types deal directly with how the computer functions and runs. The other type of storage is called secondary storage and refers to storage that isn't directly connected to the CPU, such as the hard drive. 

Hope this helped you out! :-)
5 0
3 years ago
On a web page coded in HTML, there is a sentence that reads, "Welcome to Assessments Section." Sam wants to insert the word "the
Natalka [10]

Answer:

The inserted text will appear as underlined text. The deleted text will appear as strike through text.

Explanation:

In HTML the text which has been inserted will appear as underlined text. It means if we insert something in HTML then it will underline it. This will highlight the text that has been inserted. While on the other hand if we delete some text and replace it with some other text, then it will appear as strikethrough text.

Strikethrough text is the text which is represented with a horizontal line in its center. It represents those words which are added by mistake and are not meant for inclusion.

7 0
4 years ago
9. Government and corporate officials concerned about security threats do not bring their own cell phones or laptops when travel
tatuchka [14]

Answer:

True

Explanation:

It is known as Don-Not-Carry rules are implemmented to avoid

-Unauthorized full disk copies (it have been made while the laptop owner was out of the hotel room on overseas travel)

-Laptops steals

- Monitoring by third parties of wireless using.

3 0
3 years ago
Select the correct answer. Which is an example of noisy data in data sources? A. Age: 987 B. Gender: Male C. First Name: Gary D.
umka21 [38]

Answer:

A. Age 987 is the noisy data

Explanation:

Undoubtedly, this one is, as it is going to create a buzz in each person ear, who is going to listen it.  This age is almost impossible. However, some Monks from Tibet have been able to live for so long however! And this makes my answer a noisy data, as many will not believe on first read. Something which is rare, is the noisy data. And when it is proved and accepted, it becomes a noisy information.

7 0
3 years ago
What symbol is used to indicate that an absolute reference should be used when a formula is copied? In Excel
sashaice [31]
The answer to your question is: The $ symbol shows an absolute reference.
6 0
3 years ago
Read 2 more answers
Other questions:
  • What commands will reset a network interface in Linux?
    13·1 answer
  • A collision volume is called ____
    7·1 answer
  • In which step of web design is storyboarding helpful?
    14·1 answer
  • An electronic résumé is a plain-looking document. Please select the best answer from the choices provided T F
    14·2 answers
  • The radix sort
    14·1 answer
  • How are logical operators used?
    14·1 answer
  • Which of the following is not a characteristic of a healthy relation?
    13·1 answer
  • Hey you know Python? Could you help me, please? It's for my Final please help me SOS.
    8·1 answer
  • Order the steps for accessing the junk email options in outlook 2016
    14·1 answer
  • what is the role of media in our society, and how can we become responsible consumers producers of news and information in the d
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!