C++ Find the Area of the Largest Rectangle

C++ Find the Area of the Largest Rectangle




Program to READ SIDES OF 3 RECTANGLES AND FIND THE AREA OF THE LARGEST RECTANGLE

#include<iostream.h>
class rectangle
{
int l,b;
int area[3];
public:
void input();
void largest();
};
void rectangle::input()
{
for(int i=0;i<=2;i++)
{
cout<<”\nEnter the Length(cm) : “;
cin>>l;
cout<<”\nEnter the Breadth (cm): “;
cin>>b;
area=l*b;
cout<<”\nArea is: “<<area<<”(Cm square) “;
}
}
void rectangle::largest()
{
int large=area[0];
for(int j=0;j<=2;j++)
{

if(large<area[j])
{
large=area[j];
}
}
cout<<”\nLargest area is :”<<large<<” (Cm square) “;
}

void main()
{
rectangle R;
R.input();
R.largest();
}

Click here for more C++ Programs

info@C++

C++ (pronounced “cee plus plus”).C++ is a general-purpose,powerful programming language.C++ is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. C++ was Developed by Bjarne Stroustrup starting in 1979.C++ adds OOPS-object oriented features such as classes, and other enhancements to the C programming language.


Rate this post




Further Reading:
http://en.wikipedia.org/wiki/Find
http://en.wikipedia.org/wiki/Area
http://en.wikipedia.org/wiki/Largest

You read About:C++ Find the Area of the Largest Rectangle

Posted by: Prateek on October 6, 2011


Previous Post: « Next Post: »

© 2017 Trendfy. All rights reserved
Blog Managed by Prateek Jaiswal