Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <chrono>
- using namespace std;
- using namespace std::chrono;
- void function()
- {
- int num = 0;
- for (long long i = 0; i != 20000000; ++i)
- {
- num = rand();
- }
- }
- int main()
- {
- high_resolution_clock::time_point t1 = high_resolution_clock::now();
- function();
- high_resolution_clock::time_point t2 = high_resolution_clock::now();
- auto duration = duration_cast<milliseconds>(t2 - t1).count();
- cout << duration;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement