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
r packages include sample datasets. they also include reusable r functions and documentation about how to use the functions. Tru
Dvinal [7]

r packages include sample datasets. they also include reusable r functions and documentation about how to use the functions.

The above statement is <u>True</u>.

What are R packages?

<u>The statistical programming language R has extensions </u>known as R packages. Users of R can install R packages by <u>accessing a centralized software repository like CRAN</u>, which often contains code, data, and documentation in a common collection format.

The "library" directory is <u>where R </u><u>packages </u><u>are kept in the R environment</u>. During installation, R automatically install a number of packages. Later, when additional packages are required for a particular task, they are added.

To learn more about R packages, use the link given
brainly.com/question/26125959
#SPJ4

7 0
10 months ago
To prevent class objects from being copied or assigned, you can:
Travka [436]

Answer:

The correct answer to the following question is option 4.

Explanation:

The private class does not mean that the package-private, it means that no other class can see its members.  

It is used in creating the building blocks which is implementing the internal functionality that you don't want to visible to the other projects using the library.

We can use private constructor to ensure that more than one object cannot be created at the time.

6 0
2 years ago
Brain of the computer system is called​
bagirrra123 [75]

Answer:

central processing unit in short form CPU :)

5 0
3 years ago
Read 2 more answers
To save a file in word, you can select File, Save (save as), select the location, type the file name, and select save. What is t
Inessa [10]

Answer:

The answer to this question is given below in the explanation section

Explanation:

To save a file in word, you can select File, Save (save as), select the location, type the file name, and select save.

If you want to save the file in word using shortcut. Then, for saving the file, you need to press Ctrl+S. If you want to save the file as (Save as), then you need to press F12.

3 0
3 years ago
A menu within a menu is called what?​
Aneli [31]

Answer:

a submenu

Explanation:

a menu inside a menu is called a submenu or recursive menu

4 0
3 years ago
Other questions:
  • When installing conduit for a mast service, what type of conduit should you use?
    9·2 answers
  • You can tell that the equals() method takes a ____ argument because parentheses are used in the method call.
    6·1 answer
  • Which finger types the return or enter key?
    6·2 answers
  • What the gas line in the car
    12·1 answer
  • A final class can't be extended.TrueFalse
    5·1 answer
  • What are some other ways to program a robot to navigate a complicated environment other than straight paths and right angle (90
    15·1 answer
  • The inFS.open(str) function has a string parameter str that specifies the _____ of the file to open.
    10·1 answer
  • Write a Java program that will be able to generate the sample table below.
    5·1 answer
  • What are the features of the title bar for the Microsoft word application?​
    15·2 answers
  • What is the difference between margin and padding property?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!