¿Cómo programar el área de un rectángulo en C? ¿Se requiere utilizar programación de clases?
#include lt;iostream.hgt;
clase cfx
{
flotador s, a, b
público:
cfx(flotante x, flotante y)
{
s=0;
a=x;
b=y;
}
void mianji()
{
s=a*b ;
}
void display()
{
coutlt;lt;"El área del rectángulo es:" lt;lt; slt;lt;endl;
}
};
void main()
{
float x, y;
coutlt;lt;"Ingrese largo y ancho:";
cingt;gt;x;
cingt;gt ;y;
cfx obj(x,y);
obj.mianji();
obj.display();
}