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 1001. Reverse Root

How do I know when the input has ended?
Posted by HappyPerson 8 Mar 2012 04:25
I know this might sound stupid, but how am I supposed to know when I've finished inputting numbers? I don't see anything saying what A is equal to, so how do I know?
Re: How do I know when the input has ended?
Posted by Erop [USU] 9 Mar 2012 13:50
read FAQ.

for C++:

double n;
while (scanf("%lf", &n) != EOF)
{
   ...
}
Re: How do I know when the input has ended?
Posted by dims 7 Jun 2012 20:58
I have the same question.
What about Java? there's no answer to that in FAQ.
Re: How do I know when the input has ended?
Posted by Noob 7 Jun 2012 22:12
Just catch Exception :D
Re: How do I know when the input has ended?
Posted by Haji 24 Jan 2013 12:21
How to make the EOF? I mean how does it know when the user stopped inputting?
Re: How do I know when the input has ended?
Posted by Megakrit 25 Jan 2013 22:58
As for C#, you can use (as an example):

string[] inputValues = Console.In.ReadToEnd().Split(new char[] {' ', '\t', '\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);
Re: How do I know when the input has ended?
Posted by Your_Y 2 Feb 2013 14:58
///
Edited by author 02.02.2013 14:58

Edited by author 02.02.2013 14:58
Re: How do I know when the input has ended?
Posted by Faruk 3 Dec 2014 10:40
I have same prblm in  c.
Re: How do I know when the input has ended?
Posted by Pavel Nikolov 11 Dec 2014 14:46
I have the same problem with Go. Can someone help me.
Re: How do I know when the input has ended?
Posted by Romina 24 Dec 2014 23:57
For windows command prompt CTRL Z would be interpreted as EOF
Re: How do I know when the input has ended?
Posted by Ashfaqur Rahman 17 Aug 2015 05:01
For linux terminal Ctrl + d is the EOF character.
Re: How do I know when the input has ended?
Posted by Vikrant Sharma 5 Nov 2015 10:24
You'll know the input has ended when one of the following happens, depending on the method you choose to read in the first place :

InputStreamReader in;
while(in.read() != -1)

BufferedReader in;
while((line = in.readLine()) != null)
Re: How do I know when the input has ended?
Posted by Vikrant Sharma 5 Nov 2015 10:24
You'll know the input has ended when one of the following happens, depending on the method you choose to read in the first place :

InputStreamReader in;
while(in.read() != -1)

BufferedReader in;
while((line = in.readLine()) != null)