For questions where proper input specification is not given as to how to terminate the input when we have multiple test cases, how should I use scanf within a while loop
Eg : BISHOPS problem in SPOJ
cplusplus.com/reference/clib ... dio/scanf/
Read that entire page. Bookmark the root of that site while you're there too. I use it lots.
the cplusplus reference page unfortunately does not directly answer my query.
My Question is how can I test my code to read a sequence of strings without receiving the number of test cases in first line and without any termination condition to stop receiving the input. From the comment on BISHOPS Prob, I can use while( scanf(...) != EOF) but what string input would make scanf return EOF ? other then pressing something like CTRL+C which sends an interrupt signal?
Redirect stdin from a file:
test.exe <test.in >test.out
When called from the command line this will execute test.exe reading stdin from test.in and writing stdout to test.out.
If you use linux the commands are the same, except with the ./
Thanks Lippy
That helped !