ofcRS

43p19

Dec 14th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. float F(float x)
  7. {
  8.     if (abs(x) < 2) return sqrt(5*pow(x,2)+5);
  9.     else if (abs(x) >= 10) return 0;
  10.     else return abs(x)/(sqrt(5 * pow(x, 2) + 5));
  11. }
  12.  
  13. void F(float x, float &y)
  14. {
  15.     if (abs(x) < 2) y = sqrt(5 * pow(x, 2) + 5);
  16.     else if (abs(x) >= 10) y = 0;
  17.     else y = abs(x) / (sqrt(5 * pow(x, 2) + 5));
  18.     cout << y;
  19. }
  20.  
  21. int main()
  22. {
  23.     float y, x;
  24.     cout << "x = "; cin >> x;
  25.     F(x, y);
  26.     cout << F(x);
  27.     system("pause");
  28. }
Advertisement
Add Comment
Please, Sign In to add comment