Guest User

TEST

a guest
Sep 29th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include<iostream>
  2. #include<chrono>
  3.  
  4. class Timer {
  5. using clock_t = std::chrono::high_resolution_clock;
  6. using microseconds = std::chrono::microseconds;
  7. public:
  8. Timer() : start_t(clock_t::now()) {}
  9. ~Timer() {
  10. const auto finish = clock_t::now();
  11. const auto us = std::chrono::duration_cast<microseconds> (finish - start_t).count();
  12. std::cout << us << " us" << std::endl;
  13. }
  14. private:
  15. const clock_t::time_point start_t;
  16. };
  17.  
  18. int main () {
  19. for (int i = 0; i < 1000000; ++i)
  20. std::cout << i << std::endl;
  21. Timer t;
  22. int b = 0;
  23. b = 2 + 2;
  24. std::cout << b;
  25. std::cout << "Ver.1";
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment