Codeforces и Polygon могут быть недоступны в период с 23 мая, 7:00 (МСК) по 23 мая, 11:00 (МСК) в связи с проведением технических работ. ×

Блог пользователя IF-THEN

Автор IF-THEN, история, 4 года назад, По-английски

What doe the following code mean ? Why use it ?

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I understand that It may be a bit annoying for many to answer this question so they will ignore it. What I don't understand is the reasons why some idiots are downvoting.

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    https://www.youtube.com/watch?v=Fql_b-xZYwQ

    See this video.... This is a setup used by many Competitive programmers. So, This code helps you to take input from this input file and show the output in the output file. And if the code is being run on any online judge like codeforces, then it won't read the input from the input files.

    Hope, I answered you just fine.

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

This means that if your _DEBUG is defined then you can read the input from input.txt file (instead of manually typing input every time you compile).