// Project MFCPoint // File MFCPoint.cpp #include #include int main() { CPoint p(34, 65), q, r; cout << p.x << " " << p.y << endl; q.x = 21; q.y = 52; r = p + q; cout << q.x << " " << q.y << " " << r.x << " " << r.y << endl << endl; CSize s(20, 30); cout << s.cx << " " << s.cy << endl << endl; r += s; cout << r.x << " " << r.y << endl << endl; CRect rect1(p, q); cout << rect1.left << " " << rect1.right << " " << rect1.top << " " << rect1.bottom << endl; CRect rect2(CPoint(5, 5), r); cout << rect2.left << " " << rect2.right << " " << rect2.top << " " << rect2.bottom << endl; // Normalizing a rectangle insures that // left <= right and top <= bottom. rect1.NormalizeRect(); cout << rect1.left << " " << rect1.right << " " << rect1.top << " " << rect1.bottom << endl; return EXIT_SUCCESS; }