#include #include #define max1(a,b) ((a > b) ? a : b) int max2(int a, int b) { if (a>b) { return a; } else { return b; } } // Change this by going to the Project menu slecting Settings // go to the "c/c++" tab then select "Optimizations" // from the Catagory drop down list. On the "Inline function // expaction" drop down select "Any Sutiable". This will add // "/OB2" to the "Product Options", be sure to remove "/ZI". //with g++ use the -O option for optimization inline int max3(int a, int b) { if (a>b) { return a; } else { return b; } } void main() { const long ITERATIONS = 100000000; clock_t StartTime; clock_t FinishTime; double Duration; StartTime = clock(); for (long i = 0; i < ITERATIONS; i++) { max3(9,7); } FinishTime = clock(); Duration = (double)(FinishTime - StartTime) / CLOCKS_PER_SEC; cout << "Elapsed Time = " << Duration << endl; }