Share
Explore BrainMass

C++ Conditional Statement Based on Time

I have written a program for multidimensional integration that employs several techniques of integration, varying over different ranges, because one technique will take less time to integrate over a certain region of space than another.

I would like to know how to write a conditional statement based on the amount of time that has passed in obtaining a result. In other words, as the process is running, it has a maximum amount of time to attempt a solution with one method, and then must switch to another method. So, after the program attempts a calculation with method "a" and does not obtain a result after an amount of time "t" , it stops using "a" and starts using method "b". So while time< t, use method a, when time>t, switch to method b. Hopefully I'm explaining this correctly. If you can just show me how to do this for a general example, I will adapt it to my system.

Solution Preview

Please check attachment.

//C++ conditional statement based on time
//
//I have written a program for multidimensional integration that employs several techniques of integration,
//varying over different ranges, because one technique will take less time to integrate over a certain region
//of space than another.
//
//I would like to know how to write a conditional statement based on the amount of time that has passed in obtaining a result.
//In other words, as the process is running, it has a maximum amount of time to attempt a solution with one method,
//and then must switch to another method.
//
// So, after the program attempts a calculation with method "a" and does not obtain a result after an amount of time "t" ,
// it stops using "a" and starts using ...

Solution Summary

C++ conditional statements base on time are examined in the solution.

$2.19