Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //перегрузка 4 № 14
  2.  
  3. #include <iostream>
  4. #include <cmath>
  5. #include <iomanip>
  6.  
  7. using namespace std;
  8.  
  9. float F(float x);
  10. void F(float x, float& y);
  11.  
  12. int main()
  13. {
  14. float a, b, y, h;
  15. cin >> a >> b >> h;
  16. cout << fixed << setprecision(7);
  17. for (float i = a; i <= b; i += h)
  18. {
  19. y = F(i);
  20. F(i, y);
  21. }
  22. }
  23.  
  24. float F(float x)
  25. {
  26. if (x < 0)
  27. return 0.2 * pow(x, 2) - x - 0.1;
  28. else if (x == 0.1)
  29. return 0;
  30. else if (x != 0)
  31. return pow(x, 2) / (x - 0.1);
  32. else
  33. return 0;
  34. }
  35.  
  36. void F(float x, float& y)
  37. {
  38. cout << x << ' ' << y << endl;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement