Advertisement
Pafnytiu

функция 4 - 16 сдать

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