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;
posted @ 2014-03-16 20:04  FREE小宝  阅读(159)  评论(0编辑  收藏  举报