Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime> // or <time.h> for old compilers
- void func();
- int main()
- {
- using namespace std;
- clock_t start, finish;
- double total(0);
- start = clock();
- func();
- finish = clock();
- total = (double)(finish - start)/CLOCKS_PER_SEC;
- cout << total << " seconds\n";
- return 0;
- }
- void func()
- {
- for (long i = 0; i < 1000000000; i++)
- ;
- }
Advertisement
Add Comment
Please, Sign In to add comment