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
Which option represents the location of the Goal Seek function?
sweet-ann [11.9K]

Answer:b

Explanation:

3 0
3 years ago
Read 2 more answers
When you need to switch on an electrical current at a remote location, would you use a relay or an amplifier?
ahrayia [7]

Answer:

Relay

Explanation:

They both perform similar functions in terms of control of voltage and current but the relay would be better because although it cannot produce a variable output like that of an amplifier, it has the capacity to isolate its input from its output.

7 0
3 years ago
Danielle, a help desk technician, receives a call from a client. In a panic, he explains that he was using the Internet to resea
marysya [2.9K]

Answer:

The customer's browser has been hijacked by some attackers may be.

Explanation:

According to customer's explanation there is  possibility that that his data may be stolen and he has to disconnect computer from network and then call given number in order to get back his data.

5 0
3 years ago
This algorithm works by selecting the smallest unsorted item in the list and then swapping it with the item in the next position
Juliette [100K]

Answer:

a) Bubble sort

Explanation:

Bubble sort is a type of sorting algorithm that swaps small value with a bigger value over a number of rounds called pass.

5 0
3 years ago
This isn't a homework question but rather a technological problem. I connected my device to the motherboard but it will not dete
Helen [10]
Re start the computer again
5 0
4 years ago
Read 2 more answers
Other questions:
  • Select one technology limitation in regards to quality improvement (QI) programs Technology is not fast enough Not all electroni
    12·1 answer
  • Universal Container sales reps can modify fields on an opportunity until it is closed. Only the sales operations team can modify
    13·1 answer
  • Does the game best fiend need wifi to play on the app?
    8·2 answers
  • What are some “creatures/animals” that Rex imitates?
    14·1 answer
  • SHOW ME SOME C++ TUTORIALS?
    10·1 answer
  • This is for career exploration, I need help please! &lt;3 HELPPPP
    8·2 answers
  • Assume a large shared LLC that is tiled and distributed on the chip. Assume that the OS page size is 16KB. The entire LLC has a
    8·1 answer
  • Please help i have 15 mins
    5·1 answer
  • Part of the operating system core is responsible for controlling security, managing the file system, and providing a platform fo
    6·1 answer
  • you have just finished developing a new application. before putting it on the website for users to download, you want to provide
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!