Seal_of_approval

p42e11

Feb 16th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. float F(float x)
  5. {
  6. if (x <= 5) return x*x+5;
  7. else if (x >=20) return 1;
  8. else return 0;
  9. }
  10.  
  11. void F(float x, float &y)
  12. {
  13. if (x <= 5) y = x*x+5;
  14. else if (x >= 20) y = 1;
  15. else y = 0;
  16. }
  17.  
  18. int main ()
  19. {
  20. float x,y,x1,y1;
  21. cin >> x;
  22. y1 = F(x);
  23. F(x,y);
  24. cout << y << " " << y1 << endl;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment