|
|
вернуться в форумHhelp Как понять когда она завершила ввод сообщения? Re: Hhelp Please use english. I translated your question with google translate and it said "How do you know when it has completed writing a message?". Well, it depends on the programming language you are using. Pascal: while not(eof(input)) (not sure if it was input) C: you usualy use while(!feof(stdin)) http://www.cplusplus.com/reference/cstdio/feof/ This doesn't seem to work (for me at least). C++: I think it's !cin.eof() (I've never used this one). Re: Hhelp Послано Zefick 7 фев 2013 12:20 > C: you usualy use while(!feof(stdin)) http://www.cplusplus.com/reference/cstdio/feof/> This doesn't seem to work (for me at least). This does not work if you read lines with gets and write it with puts, but feof(stdin) is works fine. May be some problems with linefeeds. Stupid MSVS. Edited by author 07.02.2013 12:20 Edited by author 07.02.2013 12:20Re: Hhelp on pascal
while not eoln do begin read(g_string); ...... ...... end; Re: Hhelp on java: Scanner scan = new Scanner(System.in); while (scan.hasNext()){ s = scan.nextLine(); } Re: Hhelp on python message = sys.stdin.readlines() and then ctrl+D to stop input |
|
|