main() function is given below. Based on this function, your task is to write complete code required to run the main() function successfully. Class Rectangle { Private: int len;

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 29SA
icon
Related questions
Question

A main() function is given below. Based on this function, your task is to write complete code required to run the main() function successfully.

Class Rectangle
{
Private:
int len;
int width;
static int objectCount;
public:
All functions that are needed.

};
int main()
{
int len;
int width;

cin>>len;
cin>>width;

Rectangle r1(len,width);
Rectangle r2(4,6);

Rectangle r3();
Rectangle r4();
Rectangle r5();

r3 = r1 + r2;
r4 = r1 - r2;
r5 = r1 * r2;

if(r3 == r4)
{
cout<<"Both are equals"<<endl;
}
else if(r3 > r4)
{
cout<<"r3 is greater than r4"<<endl;
}
else if(r3 < r4)
{
cout<<"r4 is greater than r3"<<endl;
}

return 0;

}

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr