/*
* Copyright (c)2013, 烟台大学计算机与控制学院学生
* All rightsreserved.
* 文件名称: array.cpp
* 作 者: 李中意
* 完成日期:2014 年8月 5 日
* 版本号: v1.0
* 输入描述:无
*/
#include <iostream>
using namespace std;
class Rectangle
{
public:
Rectangle()
{
x1=0;
x2=0;
y1=0;
y2=0;
}
Rectangle(double a1,double b1,double a2,double b2)
{
x1=a1;
y1=b1;
x2=a2;
y2=b2;
}
void input()
{
cout<<"请输入矩形左下角和右上角顶点的坐标:"<<endl;
cin>>x1>>y1>>x2>>y2;
}
void output()
{
cout<<"该矩形的面积为:"<<((x2-x1)*(y2-y1))<<endl;
}
private:
double x1,x2,y1,y2;
};
int main()
{
Rectangle p1;
p1.input();
p1.output();
Rectangle p2(p1);
p2.output();
Rectangle p3(1,1,6,3);
p3.output();
return 0;
}