Bob103

Таблица значений системы f(x)

Oct 26th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. float f(float x)
  5. {
  6. if (fabs(x) < 2) return sqrt(5 * pow(x, 2) + 5);
  7. else if ((fabs(x) >= 2) && (fabs(x) <= 10)) return fabs(x) / sqrt(5 * pow(x, 2) + 5);
  8. else return 0;
  9. }
  10. int main()
  11. {
  12. float a, b, h, x;
  13. cout << "a="; cin >> a;
  14. cout << "b="; cin >> b;
  15. cout << "h="; cin >> h;
  16. cout << "x\tf(x)\n";
  17. for (x = a; x <= b; x += h)
  18. cout << x << "\t" << f(x) << endl;
  19. system("pause");
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment