oj课外编程题
#include <iostream>
using namespace std;
class MyCin
{
bool m;//设置bool 类型
public:
MyCin() :m(true) {}
MyCin& operator>>(int& n) {// 重载>>
if( cin >> n) m=true;
else m=false;
return *this;
}
operator bool() {
return m;
}
};
int main()
{
MyCin m;
int n1,n2;
while( m >> n1 >> n2)
cout << n1 << " " << n2 << endl;
return 0;
}
/*
输入
多组数据,每组一行,是两个整数
输出
对每组数据,原样输出
输入样例 1
12 44
344 555
输出样例 1
12 44
344 555
*/