//dev c++
// by solardo 2007-10-20
// ver.1.0
/* a class of Rectangle and its application*/
# include<iostream>
using namespace std;
class RectAngle
{
public:
RectAngle();
~RectAngle();
void SetLength();
void SetWidth();
int GetLength();
int GetWidth();
double GetArea(int len, int wid);
int GetSideLength(int len, int wid);
private:
int Length;
int Width;
};
RectAngle::RectAngle(){}
RectAngle::~RectAngle(){cout<< "Task over!"<<endl;}
void RectAngle::SetLength()
{
//Length =len;
cout<<"Please type the Length of the Rectangle!\t";
cin >> Length;
cout<<endl;
}
void RectAngle::SetWidth()
{
//Width=wid;
cout<<"Please type the Width of the Rectangle!\t";
cin >> Width;
cout<<endl;
}
int RectAngle::GetLength()
{
return Length;
}
int RectAngle::GetWidth()
{
return Width;
}
double RectAngle::GetArea(int len, int wid)
{
return len* wid;
}
int RectAngle::GetSideLength(int len, int wid)
{
return 2*(len+ wid);
}
int main()
{
RectAngle Rec;
Rec.SetLength();
Rec.SetWidth();
int l= Rec.GetLength();
int w = Rec.GetWidth();
cout<<"Rec's Area is: " <<Rec.GetArea(l, w)<<endl;
cout<<"Rec's SideLength is:"<< Rec.GetSideLength(l, w)<<endl;
Rec.~RectAngle();
system("pause");
return 0;
}