我这输入输出真的没毛病吗

#include <cstdio>

class triangle {
private:
    int y, x; // 分别代表A和B的纵坐标和横坐标
public:
    triangle(int y = 0, int x = 0) : y(y), x(x) {}
    int display_x() {
        return x;
    }
    int display_y() {
        return y;
    }
    triangle operator+(const triangle &other) {
        return triangle(y + other.y, x + other.x);
    }
};

int main() {
    int a, b;
    triangle ans;
    while (scanf("%d%d", &a, &b) != EOF) {
        if (!a) break;   // 某条边长度是0,不是三角形,跳过
        triangle tri(a, b);
        ans = ans + tri;
    }
    printf("A(0,%d),B(0,0),C(%d,0)\n", ans.display_y(), ans.display_x());
    return 0;
}