Trace the execution of program Demo . The data is keyed as follows: 10 23 What i
ID: 3614786 • Letter: T
Question
Trace the execution of program Demo. The data is keyed as follows:
10 23
What is printed?
// Program Demo prompts for and reads two integer
// values that represent the sides of a rectangle.
// The area of the rectangle is calculated and printed.
#include <iostream>
using namespace std;
void GetData(int&, int&); // function prototype
// GetData gets two integer values.
int main()
{
int height;
int width;
int area;
GetData(height, width);
area = height * width;
cout << "The area of the " << height << " by "
<< width << " rectangle is " << area << endl;
return 0;
}
//******************************************************
void GetData(int& firstValue, int& secondValue)
// Post: The user has been prompted to input two values
// representing the length and width of a rectangle.
// These values have been read and returned in
// firstValue and secondValue.
{
cout << "Enter two integer values representing "
<< "a rectangle. Press return." << endl;
cin >> firstValue >> secondValue;
}
Explanation / Answer
//Hope this will helpyou. Enter two integer valuesrepresenting a rectangle. Press return.10 23
The area of the 10 by 23 rectangle is 230
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.