fork download
  1. #include <iostream>
  2. #include <time.h>
  3.  
  4. using std::cout;
  5. using std::endl;
  6.  
  7. int main()
  8. {
  9. clock_t t;
  10. t = clock();
  11. cout << t <<"\n";
  12.  
  13. size_t size = 100000;
  14. int *pInt = new int[size];
  15. for(size_t i = 0; i < size; i++)
  16. pInt[i] = rand();
  17. cout << clock() <<"\n";
  18. t = clock() - t;
  19. cout << "time: " << t << " miliseconds" << endl;
  20. cout << CLOCKS_PER_SEC << " clocks per second" << endl;
  21. cout << "time: " << t*1.0/CLOCKS_PER_SEC << " seconds" << endl;
  22.  
  23. system("pause");
  24. delete [] pInt;
  25. return 0;
  26. }
Success #stdin #stdout #stderr 0s 4540KB
stdin
Standard input is empty
stdout
4426
6006
time: 1582 miliseconds
1000000 clocks per second
time: 0.001582 seconds
stderr
sh: 1: pause: not found