Advertisement
polpoteu

Untitled

Nov 13th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. using namespace std;
  4.  
  5.  
  6.  
  7. int main(int argc, char** argv)
  8. {
  9.     cout<<"Podaj wielkosc tablicy : ";
  10.     int n;
  11.     cin>>n;
  12.     double x=0.1;
  13.     int *a;
  14.     a = new int [n];
  15.     int v=0;
  16.     long double start=clock();
  17.     for (int i=n; i>=0; i--){
  18.         v=+a[i]+v*x;
  19.  
  20.     }
  21.     long double stop=clock();
  22.     long double czas = double(stop-start)/CLOCKS_PER_SEC;
  23.  
  24.     cout<<"Wynik to = "<< v<<endl<<"czas to= "<<czas<<endl;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement