30

 1 #include <iostream>
 2 using namespace std;
 3 class MyCin
 4 {
 5    bool value;
 6 public:
 7    MyCin():value(true){ }
 8    operator bool(){return value;}
 9    MyCin& operator>>(int& n){
10         cin >> n;
11         if(n == -1)
12             this -> value = false;
13         return *this;
14    }
15 };
16 int main()
17 {
18     MyCin m;
19     int n1,n2;
20     while( m >> n1 >> n2) 
21         cout  << n1 << " " << n2 << endl;
22     return 0;
23 }

 

posted @ 2022-09-13 22:53  balabalahhh  阅读(31)  评论(0编辑  收藏  举报