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
Evgesh-ka [11]
2 years ago
13

SummaryIn this lab, you complete a partially written C++ program that includes a function named multiplyNumbers() that multiplie

s two int values to find their product.Three ints should be passed to the multiplyNumbers() function, the two numbers to be multiplied (num1 and num2) should be passed by value, and another int (product) to hold the product of the two numbers should be passed by reference, enabling the multiplyNumbers() function to change its value.The source code file provided for this lab includes the necessary variable declarations and input and output statements. Comments are included in the file to help you write the remainder of the program.Instructions:Open the source code file named MultiplyTwo.cpp using the code editor.Write the multiplyNumbers() function, the function declaration, and the function call as indicated by the comments.Execute the program by clicking "Run Code."Rewrite the multiplyNumbers() function to pass the two numbers (num1 and num2) by value and to pass product by address.Execute the program. It should generate the same output.// MultiplyTwo.cpp - This program calculates the product of two numbers.// It demonstrates pass by reference and then pass by address.// Input: None// Output: The product of two numbers#include using namespace std;// Write function declaration hereint main(){int num1 = 10;int num2 = 20;int product = 0;// Print value of product before function callcout << "Value of product is: " << product << endl;// Call multiplyNumbers using pass by reference for product// Print value of calculated productcout << num1 << " * " << num2 << " is " << product << endl;return 0;} // End of main function// Write multiplyNumbers function here; use pass by reference for result of multiplication. Then use pass by address.
Computers and Technology
1 answer:
Maru [420]2 years ago
5 0

Answer:

Declare the method prototype using:

void multiplyNumbers(int x, int y,int &product);

Call the function using:

multiplyNumbers(num1, num2,product);

Lastly, the method is as follows:

void multiplyNumbers (int x, int y,int &product) {

  product = x * y;

  return; }

Explanation:

Declare the method prototype using

void multiplyNumbers(int x, int y,int &product);

Call the function using

multiplyNumbers(num1, num2,product);

The method is as follows; the & written in front of product implies that product is passed by reference

void multiplyNumbers (int x, int y,int &product) {

This calculate the product

  product = x * y;

This returns nothing

  return; }

<em>See attachment for complete program</em>

Download cpp
You might be interested in
What is a characteristic of the network layer in the OSI model allows carrying packets for multiple types of communications amon
Paladinen [302]

Answer:

The correct answer to the following question will be "The capacity to work without reference to the data that would be contained in each bundle".

Explanation:

  • The Layer network governs the activity of the subnet. The main objective of this layer would be to transport data over multiple links from source to destination. When two computers are linked to the same cable, see no need for the network layer.
  • The role of this layer protocols defines the configuration and handling of packets used to transfer information from one to another host.
  • The main purpose of this layer is to allow multiple channels to be intertwined. This is achieved by sending packets to network adapters that depend on algorithms to identify the best directions for the information to move. Such routes are referred to as computer circuits.

Therefore, it would be the right answer.

6 0
3 years ago
Putting the word int into a code will create a string variable?
loris [4]

Answer:

Yes it will create a string variable

4 0
2 years ago
Disadvantages of Batch<br>operation system​
jok3333 [9.3K]

Answer:

Disadvantages of Batch Operating System:

  1. The computer operators should be well known with batch systems.
  2. Batch systems are hard to debug.
  3. It is sometime costly.
  4. The other jobs will have to wait for an unknown time if any job fails.
8 0
3 years ago
Your older brother Max tells you about his secret plan to hack into his college’s computer network and change all of his grades.
viktelen [127]

Answer:

Tell him he could get kicked out of school and it can possibly show up on his record and lessen his chances of finding a job since no one will trust him. He should just focus and get his grades up instead of risking everything and "taking the easy way out".

Explanation:

6 0
1 year ago
Bends are made in pvc conduit using a tool known as a
USPshnik [31]
The answer is C) heater box
8 0
2 years ago
Read 2 more answers
Other questions:
  • Sorry to bother you guys but for some reason it wont let me comment. How can i fix this?
    5·2 answers
  • In which type of land contract does the seller earn interest on the difference between what the seller owes on an existing loan
    14·1 answer
  • Which is not an element of photography? a Cropping b Height c Directional Lighting d Framing
    11·1 answer
  • If two hosts are connected by five networks, how many frames will there be when one host sends a packet to the other host? 1 2 5
    13·1 answer
  • Describe the dynamic Network Address Translation (NAT).
    9·1 answer
  • Given the variable ip, already declared as a pointer to an integer, write the code to dynamically allocate memory for a single i
    15·1 answer
  • Both the Alphabetic Index and the Tabular List must be used to locate and assign a diagnosis code in ICD-10-CM. Group of answer
    7·1 answer
  • Christina has been asked by the firewall administration group to identify secure network protocols that can be used to prevent n
    5·1 answer
  • Role of memory in a computer system
    10·1 answer
  • Describe how you will lunch a web browser using the start menu​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!