C++重载输入流复习

C++重载输入流

#include <bits/stdc++.h>

using namespace std;

struct Point {
    int x, y;
    Point(int xx, int yy):x(xx), y(yy) {}
    Point():x(0), y(0) {}
    friend ostream& operator << (ostream &os, const Point & p) {
        os << "[" << p.x << " " << p.y << "]";
    }
    friend istream& operator >> (istream &is,Point &p) {
        is >> p.x >> p.y;
    }
} a;

int main()
{
    cin >> a;
    cout << a << endl;
    return 0;
}
全部评论

相关推荐

mjasjon:这种trash中厂 简历过筛概率比大厂还低(除阿里系)
投递哔哩哔哩等公司6个岗位
点赞 评论 收藏
分享
05-23 20:31
已编辑
武汉大学 Java
内向的柠檬精在研究求职打法:注意把武大标粗标大 本地你俩不是乱杀
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务