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
True or False:<br><br> You can convert your PowerPoint presentation in web pages.
jenyasd209 [6]

Answer:

true

Explanation:

4 0
3 years ago
Read 2 more answers
The elements in a string type array will be initialized to ____.?
ivanzaharov [21]
The elements in a string type array will be initialized to "Null".
7 0
3 years ago
In PyCharm, write a program that prompts the user for their name and age. Your program should then tell the user the year they w
Neporo4naja [7]

Answer:

def main():

   name = input("What is your name? ")

   if not name == "" or "":

       age = int(input("What is your age? "))

       print("Hello " + name + "! You were born in " + str(2021 - age))

main()

Explanation:

Self explanatory

5 0
3 years ago
The two rules within Title II of hippa that have the greatest relevance and impact on the business associates are
Ne4ueva [31]
The two rules within Title II of HIPPA (Health Insurance Portability and Accountability Act) that has great relevance and impact on the business associates are: 

1. Privacy Rule - stating of child welfare agencies
2. Security Rule - complying of HIPPA requirements
5 0
3 years ago
Read 2 more answers
what happened to the velocity at 30 centimeters down the ramp compared to 10 centimeters down the ramp ?
posledela

Answer:

The velocity at 30 centimeters down the ramp will be considerable higher compared to 10 centimeters down the ramp.

Explanation:

It is a non lineair problem, since the speed is increasing while rolling down the ramp.

We will expect therefore, that the graph of speed (on the y-axis) and position (on the x-axis) will NOT be a streight line.

if you could plot some values given, with speed (on the y-axis) and position (on the x-axis), then you could draw a smooth line through them, which would give an estimate of all points in between them.

What can be stated with only so limited information, is that the velocity at 30 centimeters down the ramp will be considerable higher compared to 10 centimeters down the ramp.

6 0
3 years ago
Other questions:
  • Which web browser below is natively available on a major operating system? ie 10 opera firefox chrome?
    12·1 answer
  • An air-conditioning system's automatic controller might directly control the
    7·2 answers
  • __________ use a challenge response mechanism in which a server challenges a user with a number, which a user must then enter in
    5·1 answer
  • An online service allows users to integrate their phonebook with their social media profiles and stores it on the cloud. The pho
    12·1 answer
  • Why can’t I “change the country” on settings??<br> (In this app)
    13·1 answer
  • Which feature of a blog allows an author to interact and get feedback from his or her readers? link pingback commenting TweetMem
    9·1 answer
  • The function below takes two numeric parameters. The first parameter specifies the number of hours a person worked and the secon
    13·1 answer
  • In minecraft Education Edition what is the crafting recipe for Balloons and Glow sticks?
    13·2 answers
  • Who is the fan of Techno gamerz and Total gaming
    10·1 answer
  • Setting up a desktop computer for anAutoCADspecialist who needs a minimum of 125 GBram which operating system would be the best
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!