Question: I need to complete this C++ program. The instructions are in the green commentaries. // This program demonstrates the use of pointer variables // It

I need to complete this C++ program. The instructions are in the green commentaries. I need to complete this C++ program. The instructions are in the // This program demonstrates the use of pointer variables

// It finds the area of a rectangle given length and width

// It prints the length and width in ascending order

#include

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

cin >> length;

cout

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

if (// Fill in the condition of length > width by using only the pointer variables)

cout

else if (// Fill in the condition of width > length by using only the pointer

// variables)

cout

else

cout

return 0;

}

// This program demonstrates the use of pointer variables // It finds the area of a rectangle given length and widtlh // It prints the length and width in ascending order #include iostream using namespace std; in main() int, length; in width; // holds length // holds width // holds area area; *lengthEtc; //pointer which will be set to point to length int * // jnt.pointer which will be set to point to width Sout > width; // Fill in code to make lengthpoint to length (hold its address) // Fill in code to makeidtbRtr point to width (hold its address) areaL/ Fill in code to find the area by using only the pointer variables saut

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!