ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1414. Astronomical Database

C++ Input handling (end of input, that is)
Posted by Mihail Minkov 19 Sep 2007 18:46
Hi, i'm having problems with the input of this task.

How does my program know when the input is over?

It would be very helpful if you could give me a code sample (only the input, not the actual task :) ). Something like:

#what libraries the input needs

while(way to know the input is over)
{
way_to_read (scanf, cin ...something else?)
}

Thanks, I believe if i get this part, the rest will work first time :)


Re: C++ Input handling (end of input, that is)
Posted by Alias (Alexander Prudaev) 19 Sep 2007 21:04
char s[1000];

while (scanf("%s", s) != EOF)
{
  ....
}

Edited by author 19.09.2007 21:04
read faq
Posted by Vladimir Yakovlev (USU) 20 Sep 2007 15:55
Re: read faq
Posted by Denis Koshman 17 Aug 2008 23:52
while(scanf("%s", s) == 1)

Edited by author 17.08.2008 23:53