#include<iostream>
using namespace std;
class Rectangle{
public:
int j;
void area(int X=0,int Y=0,int A=0,int B=0);
private:
int x,y,a,b;
};
void Rectangle::area(int X,int Y,int A,int B){
x=X;y=Y;a=A;b=B;
j=(a-x)*(b-y);
}
int main(){
int x,y,a,b;
Rectangle rectangle;
cout<<"输入左下角坐标x和y"<<endl;
cin>>x>>y;
cout<<"输入右上角坐标为a和b"<<endl;
cin>>a>>b;
rectangle.area(x,y,a,b);
cout<<"该矩形面积为:"<<rectangle.j<<endl;
return 0;
}
using namespace std;
class Rectangle{
public:
int j;
void area(int X=0,int Y=0,int A=0,int B=0);
private:
int x,y,a,b;
};
void Rectangle::area(int X,int Y,int A,int B){
x=X;y=Y;a=A;b=B;
j=(a-x)*(b-y);
}
int main(){
int x,y,a,b;
Rectangle rectangle;
cout<<"输入左下角坐标x和y"<<endl;
cin>>x>>y;
cout<<"输入右上角坐标为a和b"<<endl;
cin>>a>>b;
rectangle.area(x,y,a,b);
cout<<"该矩形面积为:"<<rectangle.j<<endl;
return 0;
}