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
Interest accumulated on the principle of a loan must also be paid. The accumulated interest is known as which of the following?
tangare [24]
I think B but idk lol
7 0
3 years ago
What are the types of action involving data base?
Alexeev081 [22]

Answer: The DBMS is a software system that explains the four types of actions, which are defining, constructing, manipulating, and sharing databases among various users and applications.

3 0
3 years ago
What is a unit to measure loudness
FinnZ [79.3K]

decibels i believe is the correct answer. hope it helps :)

3 0
3 years ago
Assume we perform a known-plaintext attack against DES with one pair of plaintext and ciphertext. How many keys do we have to te
nasty-shy [4]

Answer:

2^{55} keys in a worst case scenario

Explanation:

So, Average will be : 2^{56} /2

2^{55}(Answer)

5 0
3 years ago
There are how many GPS satellites orbiting the earth
exis [7]
The baseline satellite<span> constellation consists of 24 </span>satellites<span> positioned in six </span>earth-centered orbital planes with four operation satellites<span> and a spare </span>satellite<span> slot in each orbital plane.</span>
5 0
3 years ago
Other questions:
  • One type of technology that can verify a person's identity is _____.
    6·2 answers
  • If you wish to maintain a consistent style to all the documents you create, it would be helpful to use a _____.
    10·1 answer
  • True false you cannot fill in a callout​
    14·1 answer
  • 1. Which plot element is typically the turning point and the most intense moment of a story? (1 point)
    11·2 answers
  • When was unicode invented?
    13·1 answer
  • ________ gives its approval to U.S. e-commerce websites that follow strict privacy standards, such as explaining to visitors how
    6·1 answer
  • The continue statement _________.
    11·1 answer
  • What is a Software that interprets commands drom the keyboard and mouse
    13·1 answer
  • What is one pass of a coding sequence called?​
    13·2 answers
  • What are the 3 rules of music<br><br> ps: there is no music subject so i had to put something else
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!