Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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. image text in transcribed // 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

ISBN: 0071808183, 9780071808187

More Books

Students also viewed these Databases questions