Write a program to create a class which name is rectangle and also creat two data members Wich data type is float and calculate area of triangle which formula is(area=1/2 *base*height) uses constructor
Here is program:
class rectangle
{
public:
rectangle(int base, int height, float area)
{
area = 1 / 2 * base * height;
}
private:
int base;
int height;
float area;
};
Comments
Leave a comment