#include<iostream>
using namespace std;
class Rectangle{
private:
int width, height, area, perimeter;
public:
Rectange(){
width = 0;
height = 0;
area = 0;
perimeter= 0;
}
Rectangle(int w, int h){
width = w;
height = h;
area = 0;
perimeter = 0;
}
void setWidth(int w){
width = w;
}
void setHeight(int h){
height = h;
}
int getArea(){
return area;
}
int getPerimeter(){
return perimeter;
}
void computeArea(){
area = height * width;
}
void computePerimeter(){
perimeter = 2 * (width + height);
}
};
int main(){
Rectangle rec(8,8);
rec.computeArea();
rec.computePerimeter();
cout<<"The area of the rectangle: "<<rec.getArea()<<endl;
cout<<"The perimeter of the rectangle: "<<rec.getPerimeter()<<endl;
}
Comments
Leave a comment