You are on page 1of 1

#include<stdlib.

h>
#include<stdio.h>

class rectangle {
float width, height;
public:
rectangle();
rectangle(float, float);
float area(void) { return width*height; }
};

rectangle::rectangle() {
width = 5;
height = 5;
}

rectangle::rectangle(float a, float b) {
width = a;
height = b;
}

int main()
{
rectangle rect(3, 4);
printf("Area %f\n", rect.area());
system("pause");
return 0;
}

You might also like