Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <vector>
  2. #include <iostream>
  3. #include <cmath>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. double b, N;
  9.  
  10. double fun(const double &x)
  11. {
  12.     return (b * x * x) / (N + x);
  13. }
  14.  
  15. int main()
  16. {
  17.     freopen("input.txt", "r", stdin);
  18.     freopen("output.txt", "w", stdout);
  19.  
  20.     cout << fixed << setprecision(8);
  21.  
  22.     cin >> b >> N;
  23.  
  24.     double Max = 100;
  25.     double h = 0.1;
  26.  
  27.     vector <double> x;
  28.     x.push_back(0);
  29.  
  30.     for (double i = h; i <= Max; i += h)
  31.         x.push_back(x[x.size() - 1] + h * fun(i - h));
  32.  
  33.     auto it = x.begin();
  34.  
  35.     for (double i = h; i <= Max; i += h, it++)
  36.         cout << "(" << i << "; " << *it << ")" << endl;
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement