Could someone help me work out these problems with the following code? Exercise
ID: 3657296 • Letter: C
Question
Could someone help me work out these problems with the following code?
Exercise 1: Complete this program by filling in the code (places in bold). Note: use only pointer variables when instructed to by the comments in bold. This program is to test your knowledge of pointer variables and the & and * symbols.
Exercise 2: Run the program with the following data: 10 15. Record the output here.
#include <iostream>
using namespace std;
int main()
{
int length; // holds length
int width; // holds width
int area; // holds area
int *lengthPtr; // int pointer which will be set to point to length
int *widthPtr; // int pointer which will be set to point to width
cout << "Please input the length of the rectangle" << endl;
cin >> length;
cout << "Please input the width of the rectangle" << endl;
cin >> width;
// Fill in code to make lengthPtr point to length (hold its address)
// Fill in code to make widthPtr point to width (hold its address)
area = // Fill in code to find the area by using only the pointer variables
cout << "The area is " << area << endl;
if (// Fill in the condition of length > width by using only the pointer variables)
cout << "The length is greater than the width" << endl;
else if (// Fill in the condition of width > length by using only the pointer
// variables)
cout << "The width is greater than the length" << endl;
else
cout << "The width and length are the same" << endl;
return 0;
}