0

Jungle Camping challenge code not running as expected

Hello, I've attempted the Jungle Camping challenge recently and it turns out the code I've written is not executing as expected. The following works flawlessly on GCC: https://code.sololearn.com/cFRsSSlGMszP/?ref=app I suspect the condition used in the loop is at fault here, because SoloLearn's evaluator doesn't input a newline character when the program asks for input. Any tips on how to get around that would be highly appreciated. TL;DR - I need ideas on how to check for the end of stdin without relying on a newline character (or any other additional character that could be added to it during input).

18th Apr 2020, 5:04 PM
Kotz
Kotz - avatar
3 Réponses
+ 1
This actually did the trick. Thanks!
18th Apr 2020, 8:03 PM
Kotz
Kotz - avatar
+ 1
Your welcome :)
18th Apr 2020, 8:03 PM
Denise Roßberg
Denise Roßberg - avatar
0
Hello Kotz Maybe this helps you: https://stackoverflow.com/questions/10720821/im-trying-to-understand-getchar-eof }while (getchar() != EOF); should work.
18th Apr 2020, 7:03 PM
Denise Roßberg
Denise Roßberg - avatar