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
A developer has made a change to an Automation Anywhere TaskBot using the Enterprise Client interface. When running the bot from
Furkat [3]

Answer:

Copy the Task Bot from the client device to the control room server.

Explanation:

First, we need to understand what we mean by Automation Anywhere: This is a web based controlled and  popular robotic process automation (RPA) vendors offering powerful & user-friendly RPA capabilities to automate any complex tasks. It is one of the "Revolutionary Technology" that changes the way the enterprise operates. This tool combines conventional RPA with intellectual elements like natural language understanding and reading any unstructured data.

Automation Anywhere allows organizations to automate the processes which are performed by the humans. It is a Web-Based Management System which uses a Control Room to run the Automated Tasks. Automation Anywhere tool can automate ends to end business operations for companies.

4 0
4 years ago
Linda is searching for a new job. Which information would her potential employers likely review in her social profile?
nasty-shy [4]
The answer will be A they would wanna know about her work history
3 0
3 years ago
Read 2 more answers
Help me with this two questions please
AnnyKZ [126]

Answer:

1 is def... don't know about the other one though sorry

6 0
2 years ago
Should there be an agency in charge of the Internet? How would business, government, and education be impacted if the Internet w
aksik [14]
I believe the government should not be able to regulate or control the internet. The internet is a place to express and exchange new ideas. And when an agency or government starts to regulate the internet, they can prevent from view certain content.

There is something called net neutrality. Its definition can be found on Google, "the principle that Internet service providers should enable access to all content and applications regardless of the source, and without favoring or blocking particular products or websites." - Google

What that means is, that internet service providers (ISP's) should provide all content without discrimination. For example. There is two ISP's. ISP A and ISP B. ISP B does not practice net neutrality. So, when a customer has ISP B's service, he/she cannot view content from ISP A. Or whatever company or websites ISP B does not want you to view. On the contrary, ISP A practice net neutrality. ISP A provides all content for its customers. Even if ISP A doesn't like ISP B or any websites, it still allows their customers to view that content. 

I support for new neutrality. And so should you.
3 0
4 years ago
A slide in Olivia's presentation has the Title and Content layout applied. The bulleted list on the slide contains 14 items and
Harrizon [31]

Answer:

1) Right-click the slide, select Layout, and select Two Content

2) <em>*While on the same slide* </em>-go to the Ribbon, select Layout and select Two Content.

Explanation:

Either of these options will change the layout of the slide. After this is done, select 8-14 and cut and paste them in the second text box. Then format them to look aesthetically pleasing.

8 0
4 years ago
Other questions:
  • When you want to print a page from the World Wide Web, select the print command in the _____.
    8·2 answers
  • Why is there more content on youtube in 4k then there is on cable, satellite, and digital tv combined?
    6·2 answers
  • According to the ________ definition of organizations, an organization is seen as a means by which primary production factors ar
    14·1 answer
  • What are the advantages of homogenation
    5·1 answer
  • The two ways to use the help menu is by searching of the contents or searching the _____
    13·2 answers
  • Go in my discord server Code is . (CebjBXN)​
    10·2 answers
  • ????????????????????????????????
    5·1 answer
  • Lesson 3 - Calling All Operators
    6·1 answer
  • What the advantages and disadvantages of file sharing to the users​
    9·1 answer
  • What are the four components of security documentation?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!