文章目录
原题题目

#include
#include using namespace std;
template <class T>
class CMyistream_iterator
{
};int main()
{ int t;cin >> t;while( t -- ) {CMyistream_iterator<int> inputInt(cin);int n1,n2,n3;n1 = * inputInt; int tmp = * inputInt;cout << tmp << endl;inputInt ++; n2 = * inputInt; inputInt ++;n3 = * inputInt; cout << n1 << " " << n2<< " " << n3 << " ";CMyistream_iterator<string> inputStr(cin);string s1,s2;s1 = * inputStr;inputStr ++;s2 = * inputStr;cout << s1 << " " << s2 << endl;}return 0;
}
代码实现
private:T ret;bool read;
public:CMyistream_iterator(istream & a){read = false;}T operator*(){if(!read){cin>>ret;read = true;}return ret;}void operator++(int n){read = false;}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!