daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <chrono>  // for high_resolution_clock
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     // Record start time
  8.     int b = 1;
  9.     string a = "1";
  10.     auto start = chrono::high_resolution_clock::now();
  11.    
  12.     // Portion of code to be timed
  13.     for(int i = 0; i < 100000000; i++) {
  14.         if(!(a == "hello")) b++;
  15.     }
  16.  
  17.     // Record end time
  18.     auto finish = chrono::high_resolution_clock::now();
  19.  
  20.     chrono::duration<double> elapsed = finish - start;
  21.     cout << "Elapsed time: " << elapsed.count() << " s\n";
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top