Реферат: Объектно ориентированое програмирование на С
return a*b;
};
double rectangle::perimeter()
{
return 2*a+2*b;
};
double rectangle::diagonal()
{
return sqrt(a*a+b*b);
};
int rectangle::is_square()
{
if(a==b) return 1;
return 0;
};
void rectangle::print_rectangle()
{
char msg1[]=" ", msg2[]=" not ";
cout<<"a="<<a<<" b="<<b;
cout<<"\nS= "<<square()<<" m^2 P="<<perimeter()<<" m d="<<diagonal()<<" m";
cout<<"\nRectangle is";
if(is_square())
cout<<msg1;
else
cout<<msg2;
cout<<"square.\n";
return;
};
#endif