Most of the people write this in their code.
What dose it mean?
what is the use of #ifndef
.
#ifndef ONLINE_JUDGE
freopen("E://ADpan//in.in", "r", stdin);
freopen("E://ADpan//out.out", "w", stdout);
#endif
Most of the people write this in their code.
What dose it mean?
what is the use of #ifndef
.
#ifndef ONLINE_JUDGE
freopen("E://ADpan//in.in", "r", stdin);
freopen("E://ADpan//out.out", "w", stdout);
#endif
A cursory google search led to this post. To summarize: there are online coding competitions where predefined input is sent to stdin
and expected on stdout
. When testing and developing locally, some people prefer to hack their program to read from files instead, so they do not have to do something like
test_program < input | diff - expected_output
Finally, the ONLINE_JUDGE
macro is defined in the competition environment, so that uses stdin
/stdout
, while a local compilation will not have that macro and thus read from those files.