11 novembre
写了这个东西玩,当不想用scanf又不得不用的时候,就派上用场了。。。
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
#define __STRING_IO
const char __END_OF_LINE = '\n';
#ifdef __STRING_IO
char __tmpInputStr[10000];
#endif
class __Cin {
private: bool isEnd;
public:
__Cin() { isEnd = false; };
__Cin& operator>> (int &a) { isEnd = (scanf("%d", &a) == EOF); return *this; }
__Cin& operator>> (char &c) { isEnd = (scanf("%c", &c) == EOF); return *this;}
__Cin& operator>> (char* &s) { isEnd = (scanf("%s", s) == EOF); return *this;}
__Cin& operator>> (long long &a) { isEnd = (scanf("%lld", &a) == EOF); return *this;}
#ifdef __STRING_IO
__Cin& operator>> (string &s) { if (scanf("%s", __tmpInputStr) == EOF) isEnd = true; else s.assign(__tmpInputStr); return *this;}
#endif
operator bool() const { return !isEnd; };
} __cin;
struct __Cout {
__Cout& operator<< (const int &a) { printf("%d", a); return *this; }
__Cout& operator<< (const char &c) { printf("%c", c); return *this; }
__Cout& operator<< (const char* &s) { printf("%s", s); return *this; }
__Cout& operator<< (const long long &a) { printf("%lld", a); return *this; }
#ifdef __STRING_IO
__Cout& operator<< (const string &s) { printf("%s", s.c_str()); return *this; }
#endif
} __cout;
#define cin (__cin)
#define cout (__cout)
#define endl (__END_OF_LINE)
int main() {
int a;
while (cin >> a) {
cout << a << endl;
}
}