其他分享
首页 > 其他分享> > 30

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 }

 

标签:return,int,30,MyCin,value,bool,operator
来源: https://www.cnblogs.com/balabalabubalabala/p/16691296.html