#include
using namespace std;
void main(void)
{
class Rectangle
{
public:
void perimer(int width,int length);
void area(int width,int length);
private:
int width,length;
};
inline void Rectangle::perimer(int width,int length)
{
cout<<"width:"<
cin>>width>>length;
perimer=width+length;
}
inline void Rectangle::area(int width,int length)
{
cout<<"width:"<
cin>>width>>length;
area=width*length;
}
void main(void)
{
Rectangle g;
g.perimer();
g,area();
}
}
#include <iostream>
using namespace std;
class Rectangle
{
public:
Rectangle(int w = 0, int l = 0) : width(w), length(l) {}
void perimer();
void area();
void set(int w, int l)
{
width = w;
length = l;
}
private:
int width, length;
};
void Rectangle::perimer()
{
cout << "perimer: " << 2 * (width + length) << endl;
}
void Rectangle::area()
{
cout << "area: " << width * length << endl;
}
int main(void)
{
int w, l;
Rectangle g(1, 2);
g.perimer();
g.area();
cin >> w >> l;
g.set(w, l);
g.perimer();
g.area();
}