1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
class Rectangle{
private:
int x1, x2, y1, y2;
public:
Rectangle(int a, int b, int c, int d){
a = x1;
b = x2;
c = y1;
d = y2;
};
Rectangle(){
x1 = 1;
x2 = 1;
y1 = 1;
y2 = 1;
};
void setPoints(int a, int b, int c, int d){
a = x1;
b = x2;
c = y1;
d = y2;
};
int getX1(){
return x1;
};
int getX2(){
return x2;
};
int getY1(){
return y1;
};
int getY2(){
return y2;
};
void printPoint1(){
cout << "(" << x1 << "," << x2;
};
void printPoint2(){
cout << "(" << y1 << "," << y2;
};
};
int main(int argc, char *argv[])
{
Rectangle rect;
rect.setPoints(100, 300, 250, 150);
cout << "First point: (" << rect.getX1() << "," << rect.getY1() << ")" << endl;
cout << "Second point: (" << rect.getX2() << "," << rect.getY2() << ")" << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
|