Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- int main(int argc, char** argv)
- {
- clock_t start, stop;
- double czas;
- cout<<"Podaj wielkosc tablicy : ";
- int n;
- cin>>n;
- srand(time(0));
- double x=0.1;
- int *a;
- a = new int [n];
- int v=0;
- start=clock();
- for (int i=0; i>n; i++){
- a[i]=rand()/double(RAND_MAX);
- }
- for (int i=n; i>=0; i--){
- v=+a[i]+v*x;
- }
- stop=clock();
- czas = double(stop-start)/CLOCKS_PER_SEC;
- cout<<"Wynik to = "<< v <<endl<<"czas to= "<< std::setprecision(20)<<czas<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement