Flowchart, create. #include using namespace std; // Write function declaration here void multiplyNumbers(int, int, int &); int main() { int num1 = 10; int num2 = 20; int product = 0; // Print value of product before function call cout << "Value of product is: " << product << endl; // Call multiplyNumbers using pass by reference for product multiplyNumbers(num1, num2, product); // Print value of calculated product cout << 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. void multiplyNumbers(int n1, int n2, int &result) { result = n1*n2; }
Flowchart, create.
#include <iostream>
using namespace std;
// Write function declaration here
void multiplyNumbers(int, int, int &);
int main()
{
int num1 = 10;
int num2 = 20;
int product = 0;
// Print value of product before function call
cout << "Value of product is: " << product << endl;
// Call multiplyNumbers using pass by reference for product
multiplyNumbers(num1, num2, product);
// Print value of calculated product
cout << 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.
void multiplyNumbers(int n1, int n2, int &result) {
result = n1*n2;
}
Step by step
Solved in 2 steps with 1 images