Bob103

IV-Part 2

Mar 19th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. float F(float x)
  6. {
  7. if (x*x + 2 * x + 1 < 2)
  8. return x*x;
  9.  
  10. else if (2 <= x*x * 2 + 1 < 3)
  11. return 1 / x*x - 1;
  12.  
  13. else return 0;
  14. }
  15.  
  16. void F(float x, float &y)
  17. {
  18. if (x*x + 2 * x + 1 < 2)
  19. y = x*x;
  20.  
  21. else if (2 <= x*x + 2 * x + 1 < 3)
  22. y = 1 / x*x - 1;
  23.  
  24. else y = 0;
  25. }
  26. int main()
  27. {
  28. float x;
  29. float y;
  30. cout << "x=";
  31. cin >> x;
  32. cout<<"F(x)=" << F(x) << endl;
  33. F(x, y);
  34. cout<<"F(x,y)="<<"("<< x << ";" << y<<")" << endl;
  35. system("pause");
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment