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]
3 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]3 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
You receive a file named Project4.xlsx as an attachment to an email message. What do you expect the file to contain?
GaryK [48]
.xlsx is an extension for Microsoft Excel. It's basically a project using Excel.
5 0
3 years ago
What are the nuclear codes?
inn [45]

Answer:

Nuclear codes allow the president to prove the individual is authorized to order the launch.

Explanation:

Hope this helps!

If not, I am sorry.

3 0
1 year ago
If your computer determines the destination address of a network packet is to a remote network.
Arisa [49]

The data link layer software would replace the MAC address of the next hop or gateway when the destination address of a network packet is to a remote network.

<h3>What is a data link layer?</h3>

The data link layer is the second layer of the OSI model and it can be defined as an interface between the network and physical layer. Also, it comprises two (2) main sublayers and these include the following:

  • Logical link control (LLC) layer.
  • Media access control (MAC) layer.

In Computer networking, the data link layer software would replace the MAC address of the next hop or gateway when the destination address of a network packet is to a remote network.

Read more on data link layer here: brainly.com/question/13131540

#SPJ1

5 0
2 years ago
Discuss in detail why you need to use a write blocker (either hardware or software) in your examinations, whether for a criminal
dolphi86 [110]

A write blocker is any tool that permits read-only access to data storage devices without compromising the integrity of the data. A write blocker, when used properly, can guarantee the protection of the data chain of custody. NIST‘s general write blocking requirements hold that:

<span>The tool shall not allow a protected drive to be changed.The tool shall not prevent obtaining any information from or about any drive.<span>The tool shall not prevent any operations to a drive that is not protected.</span></span>
8 0
3 years ago
What is heaven backwards?
sweet-ann [11.9K]
It is Nevaeh backwards hope that helps! :3 and feel free to pm me if you have anymore questions! :3
5 0
2 years ago
Read 2 more answers
Other questions:
  • George borrowed some equipment from his friend for recording his monologue for his art class. He got all the equipment except th
    15·1 answer
  • 3. Which of the following phase types will make a sound louder? In-phase, inverted phase, or partial phase angle waves?
    7·2 answers
  • If you think the user might enter 24.9, you should create a float variable. true or false
    9·1 answer
  • ​ If a class is reusable, that is to say that it can be used in several different applications, then it has been designed using
    5·1 answer
  • An anagram is a word or a phrase made by transposing the letters of another word or phrase; for example, "parliament" is an anag
    7·1 answer
  • Within a major students can choose to study a specific area within major. For example a journalism student may study military jo
    8·1 answer
  • In cell B20, enter a function to calculate the average attendance for 2018
    11·1 answer
  • Using hard disk to temporarily store data or instructions from ram is referred to as the
    12·1 answer
  • All states that have altered judicial selection techniques in recent years have adopted some form of:
    10·2 answers
  • If you are going to refer to a few dozen classes in your application, how do<br> you do it?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!