I am working on a project which has no determined algorithm to solve using C language. I am Using Monte Carlo technique for solving that problem. And the number of random guesses I want to limit to the execution time specified by the user. This means I want to make full use of the execution time limit defined by the user (as a command line argument) to make as many random iterations as possible. Can I check the execution time elapsed so far for a loop condition?
for(trials=0;execution_time<specified_time;trials++)
If so, how do I do it? Or if there is any other way also, it is welcomed. Thank You.
P.S. I am using Code Blocks 10.05 for coding and GNU compiler.