Advertisement
sellmmaahh

popravni-sept-2014-zad5

Jul 30th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdexcept>
  3. #include <list>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. list<double> Fja (double f(double), double xmin, double xmax, double dx)
  9. {  int duzina=xmax-xmin;
  10.    list<double> rez;
  11.     int i(xmin), j(0);
  12.     while(i+j*dx<=xmax && j<duzina)
  13.     {
  14.         rez.push_back(f(i+j*dx));
  15.         j++;
  16.  
  17.     }
  18.  
  19.     return rez;
  20. }
  21.  
  22. int main () {
  23. list<double> Rez{Fja([] (double x) {return 3*x*x-5;}, 0, 10, 0.1)};
  24. for (auto x: Rez) cout<<x<<" ";
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement