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;
}
上一篇:【开源小软件 】Bing每日壁纸 V1.2.1


下一篇:android 反纠结app开发: 在线程中更新view