Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int ile;
  7. clock_t start, stop;
  8. double czas;
  9.  
  10. int main()
  11. {
  12. cout << "Ile liczb w tablicy: ";
  13. cin>>ile;
  14.  
  15. int *tablica;
  16. tablica= new int [ile];
  17. int *wskaznik=tablica;
  18.  
  19. start=clock();
  20.  
  21.  
  22. for (int i=0; i<ile; i++)
  23. {
  24. *wskaznik=i;
  25. *wskaznik+=50;
  26. wskaznik++;
  27. }
  28.  
  29. stop= clock();
  30. czas=(double)(stop - start)/CLOCKS_PER_SEC;
  31. cout<<"Czas zapisu (ze wskaznikiem): "<<czas;
  32.  
  33. delete [] tablica;
  34.  
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement