Advertisement
rootuss

licznie czasu wykonywania programu

Nov 26th, 2016
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4. #include<windows.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     double stop, start;
  11.      start =clock();
  12.     cout << "Losowanie liczb!" << endl;
  13.     double liczba;
  14.  
  15.     srand(time(NULL));
  16.     liczba= 2+ (double)rand()/RAND_MAX*8;
  17.     cout<<"\a"<<liczba<<endl<<endl;
  18.  
  19.     int a=0;
  20.     while(a<=100)
  21.     {
  22.         cout<<a<<endl;
  23.         a++;
  24.     }
  25.     Sleep(2000);
  26.     cout<<endl;
  27.  
  28.  
  29.     stop=clock();
  30.     double wynik=(stop-start)/CLOCKS_PER_SEC;
  31.  
  32.     cout<<"Czas to: "<<wynik<<endl<<endl;;
  33.     system("pause");
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement