HDOJ_ How can I read input data until the end of file ?
| Language | C | C++ | Pascal |
| To read numbers | int n; while(scanf("%d", &n) != EOF) { ... } |
int n; while (cin >> n) { ... } |
var n: integer; ... while not seekeof do begin read(n); ... end; |
| To read characters | int c; while ((c = getchar()) != EOF) { ... } |
char c; while (cin.get(c)) { ... } |
var c: char; ... while not eof do begin read(c); ... end; |
| To read lines | char line[1024]; while(gets(line)) { ... } |
string line; while (getline(cin, line)) { ... } |
var line: string; ... while not eof do begin readln(line); ... end; |

浙公网安备 33010602011771号