Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <chrono>
  3. #include <ctime>    
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8.     int distanza;
  9.     cin >> distanza;
  10.    
  11.     auto start = chrono::system_clock::now();
  12.     auto end = chrono::system_clock::now();
  13.  
  14.     chrono::duration<double> elapsed_seconds = end-start;
  15.     time_t end_time = chrono::system_clock::to_time_t(end);
  16.  
  17.    
  18.     cout << "finished computation at " << ctime(&end_time)
  19.               << "Distanza percorsa:\t" << distanza
  20.                    << "\nIntervallo di tempo: " << elapsed_seconds.count() << "s\n";
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement