fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. float x, a, b, y;
  9. cout << ("input x b a:") << endl;
  10. cin >> a >> b >> x;
  11. if (x <= a)
  12. {
  13. y = a * pow(sin(x), 2) + b * pow(cos(x), 3);
  14. cout << ("y=", y);
  15. }
  16. else if (x > a && x < 4.5 * b)
  17. {
  18. y = a * tan(a * b * x);
  19. cout << ("y=", y);
  20. }
  21. else if (x > 4.5 * b)
  22. {
  23. y = a * log(fabs(a * x - b));
  24. cout << ("y=", y);
  25. }
  26. else if (x != 0) cout << ("Error, x=0");
  27. cout << ("y=", y);
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5436KB
stdin
1 2 2 1 2
stdout
input x b a:
1.157821.15782