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;
}
上一篇:EF CORE 2.0升级到6.0 记录


下一篇:让我们大声说:HelloSpring(“最易懂得Spring学习”)(上)