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
Precautionary measures to be observed when using ICT tools​
Dafna11 [192]

Answer:

ICT is the abbreviated form of Information and Communication. It included different technologies like mobile phones, computers, USBs etc.

Following are two precautionary measures which should be observed when using any kind of ICT:

  1. Use of Antivirus: It can used to protect anything placed inside the technology especially from hacking and viruses which can create many issues.
  2. Backup Data: Creating a backup of the data stored in the device is important as it can be recalled when the device malfunctions. Backup of the data can be created through using USBs, CDs etc or through cloud storage
7 0
3 years ago
Structured walk-throughs take place throughout the SDLC and are called _____ reviews, depending on the phase in which they occur
Tpy6a [65]

Answer:

design

Explanation:

Based on the information provided within the question it can be said that these are called design reviews. This is one of the most important parts of the development of a system. This focuses more on answering how something is going to be done in the system as opposed to answering what is going to be done for the system depending on the questions asked in the analysis phase.

5 0
2 years ago
The superclass Calculator contains: a protected double instance variable, accumulator, that contains the current value of the ca
yawa3891 [41]

Answer:

The following program are written in JAVA Programming Language.

//inherit the Calculator class

public class CalculatorWithMemory extends Calculator {  

   private double memory = 0.0;    //initialize double type variable

   public void save() {   //define function

       memory = accumulator;    

   }

   public void recall() {   //define function

       accumulator = memory;

   }

   public void clearMemory() {   //define function

       memory = 0;     //initialize the value

   }

   public double getMemory() {  

       return memory;    // return the value in "memory" variable

   }

}

Explanation:

Here, we inherit the property of the "Calculator" class.

Then, we define the private double type variable "memory" and assign value 0.0.

Then we set the function "save()" inside it we assign the value of "memory" in "accumulator" and close the function.

Then, we define the function "recall()" inside it we assign the value of "accumulator" in "memory" and close the function.

Then we set the function "clearMemory()" inside it we assign "memory" to 0.

After all, we set the double type function "getMemory()" inside we return the value of the "memory".

7 0
3 years ago
The discipline of building hardware architectures, operating systems, and specialized algorithms for running a program on a clus
kondaur [170]

The discipline of building hardware architectures, operating systems, and specialized algorithms for running a program on a cluster of processors is known as <u>parallel computing.</u>

<u></u>

<h3>What is Parallel Computing?</h3>

Parallel computing refers to the process of breaking down larger problems into smaller, independent, often similar parts that can be executed simultaneously by multiple processors communicating via shared memory, the results of which are combined upon completion as part of an overall algorithm. The primary goal of parallel computing is to increase available computation power for faster application processing and problem solving.

<h3>Types of parallel computing</h3>

There are generally four types of parallel computing, available from both proprietary and open source parallel computing vendors:

  • Bit-level parallelism: increases processor word size, which reduces the quantity of instructions the processor must execute in order to perform an operation on variables greater than the length of the word.
  • Instruction-level parallelism: the hardware approach works upon dynamic parallelism, in which the processor decides at run-time which instructions to execute in parallel; the software approach works upon static parallelism, in which the compiler decides which instructions to execute in parallel.
  • Task parallelism: a form of parallelization of computer code across multiple processors that runs several different tasks at the same time on the same data.
  • Superword-level parallelism: a vectorization technique that can exploit parallelism of inline code.

Learn more about parallel computing

brainly.com/question/13266117

#SPJ4

5 0
1 year ago
The following program is run. Then the user clicks the "bottomButton" TWO TIMES. What will be displayed in the console?
IrinaK [193]

Answer:

A. aaa

bbb

ccc

ccc

ddd

B. bbb

ddd

ccc

ccc

C. bbb

ddd

aaa

aaa

D. bbb

ccc

ccc

ddd

8 0
3 years ago
Read 2 more answers
Other questions:
  • What function does the ALU perform?
    10·1 answer
  • Provide an example of a time in your personal or work life when you used the household measuring system and measured out an exac
    6·1 answer
  • Define the acronym WAECUP and its components
    15·1 answer
  • The underwriters laboratories (ul) requirement for ? ground-fault circuit interrupters (gfcis) is that tripping shall occur when
    5·1 answer
  • PLEASE ANSWER ASAP
    7·1 answer
  • A technician wants to limit access to a group of folders and is using Group Policy to prevent the users in the sales department
    9·1 answer
  • Most 4 year colleges want an applicant's scores for all the following except
    12·1 answer
  • Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the
    10·1 answer
  • 4
    12·2 answers
  • 15. You read a news article that's politically biased and not well organized. It's
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!