Redirecting standard input and output to files C++
xxxxxxxxxx
// Below is C/C++ code for input/output
#include<stdio.h>
int main()
{
#ifndef ONLINE_JUDGE
// For getting input from input.txt file
freopen("input.txt", "r", stdin);
// Printing the Output to output.txt file
freopen("output.txt", "w", stdout);
#endif
return 0;
}
This technique is used in Competitive Programming