123456789101112131415161718192021222324252627282930 |
- #include <iostream>
- class Point {
- private:
- int x;
- int y;
- public:
- void setxy(int x_val, int y_val) {
- x = x_val;
- y = y_val;
- }
- void displayxy() {
- std::cout << "(" << x << "," << y << ")\n";
- }
- };
- int main() {
- Point point1, point2;
- point1.setxy(3, 4);
- point2.setxy(5, 6);
- std::cout << "The first point is:";
- point1.displayxy();
- std::cout << "The second point is:";
- point2.displayxy();
-
- return 0;
- }
|