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 was the first computer name brand
lilavasa [31]

Answer: <u>Electronic Controls Company</u> and was founded in 1949 by J. Presper Eckert and John Mauchly.

hope this helps!

4 0
2 years ago
Read 2 more answers
Alright, don't judge me, this is a question that involves my Childhood game PvZ GW 2. So I noticed mods and stuff that get uploa
Ann [662]

Answer:

honnnestlyyy, you might have to y0utub3 it

7 0
3 years ago
Read 2 more answers
To make a black and white image out of a color image, you would use which option?
fenix001 [56]
The black and white filter

6 0
3 years ago
A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 5 and 3, the result is
Vinil7 [7]

Answer:

The correct option is 1 as the overflow error has occurred

Explanation:

As the program uses 3 bits to represent integers thus the range of the maximum value that the program can store is given as

2^2+2^1+2^0=4+2+1=7

So when the two numbers in decimal base 10 are added as 3 and 5 the resultant is given as

3=(011)_2\\5=(101)_2\\\_\_\_\_\_\_\_\_\_\_\_\_\\8=(1000)_2

This is more than what the 3 bit integer can store thus the overflow error has occurred.

3 0
4 years ago
Problems and Exercises 16 through 43 are based on the entire ("big" version) Pine Valley Furniture Company database. Note: Depen
lesya [120]

Answer:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

Explanation:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

SELECT - To query the database and get back the specified fields SQL uses the select statement

CustomerID is a coloumn name

The function COUNT(OrderID) returns the number of orders

Totalorderds is a label

FROM - To query the database and get back the preferred information by specifying the table name

Order_Table is a table name

GROUP BY - The clause is used to group the result of a SELECT statement done on a table where the tuple values are similar for more than one column

The table below displays the CustomerID and total number of orders placed

CustomerID                                              Totalorders

4                                                                    28

1                                                                      6

12                                                                    5

16                                                                    5

6                                                                     3

9                                                                     3

15                                                                    3

3                                                                     1

13                                                                    1

14                                                                    1

The table below shows the total number of orders situated for each sales person

SalesPerson_ID                                         TotalOrders

3                                                                    16

2                                                                     3

4                                                                     3

5                                                                     3

3 0
3 years ago
Other questions:
  • How many megabytes of data can a factory made audio cd hold?
    13·1 answer
  • What are tags?
    13·1 answer
  • Convert 234.43 (base 7) to base 10
    7·1 answer
  • What entity created the open systems interconnection (osi) seven-layer model?
    15·1 answer
  • Li Chang has recently started his own business. He plans to launch his design for an application (app) for a smartphone. All of
    9·1 answer
  • An employee clicks on a link in an email from what looks like a fellow employee and is taken to a fraudulent web site which asks
    6·2 answers
  • A computer scientist creates an app that tells you a funny joke each time you touch the Joke button.
    15·1 answer
  • Aside from human user types, there are nonhuman user groups. Known as account types, __________ are implemented by the system to
    10·1 answer
  • Comment if u wanna text me on behance
    6·1 answer
  • Why computer is used in education sector<br>​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!