Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ctime>
- #include <chrono>
- #include <iostream>
- #include <sstream>
- #define SSTR( x ) static_cast< std::ostringstream & >( \
- ( std::ostringstream() << std::dec << x ) ).str()
- int main()
- {
- volatile int i = 0;
- auto start = std::chrono::steady_clock::now();
- while (i < 10000000) {
- ++i;
- }
- auto end = std::chrono::steady_clock::now();
- auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
- std::cout << std::endl << std::endl;
- int nn;
- nn=elapsed.count();
- std::string s = SSTR( nn );
- std::cout << " Two random digits : " << s << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement