Advertisement
Guest User

asdasfagggggggggg

a guest
Mar 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <chrono>
  3.  
  4. using namespace std;
  5. using namespace std::chrono;
  6.  
  7. void function()
  8. {
  9.     int num = 0;
  10.     for (long long i = 0; i != 20000000; ++i)
  11.     {
  12.         num = rand();
  13.     }
  14. }
  15.  
  16. int main()
  17. {
  18.     high_resolution_clock::time_point t1 = high_resolution_clock::now();
  19.     function();
  20.     high_resolution_clock::time_point t2 = high_resolution_clock::now();
  21.  
  22.     auto duration = duration_cast<milliseconds>(t2 - t1).count();
  23.  
  24.     cout << duration;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement