016 惊呆!Point竟然能这样输入输出
#include <iostream>
using namespace std;
class Point {
private:
int x;
int y;
public:
Point() { };
friend istream& operator>> (istream & is,Point & pp) {
int temp;
cin >> temp;
pp.x = temp;
cin >> temp;
pp.y = temp;
return is;
}
friend ostream& operator<< (ostream & o,const Point & pp) {
o << pp.x<<","<<pp.y;
return o;
}
};
int main()
{
Point p;
while(cin >> p) {
cout << p << endl;
}
return 0;
}