I want to find out how much time a C/C++ program takes to produce output for a certain input file.
Usually, I make an input file in txt or other format and then produce an output file in txt or any other format. For example:
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
//take input and give output
//fclose(stdin);
//fclose(stdout);
return 0;
}
I run the program and it shows execution time on the console window. But I am not sure that if this is the most accurate way to know the execution time.
I need to know the execution time of a program for a certain input file to set the time limit for a programming problem in some school level programming contest.