fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double a,b,x,y;
  7. cout<<"Input a,b,x"<<endl;
  8. cin>>a>>b>>x;
  9. if (x<=a)
  10. {
  11. y=exp(a*x)-3.8*pow(cos(a+b*x),2);
  12. cout<<"y="<<y<<endl;
  13. }
  14. else if ((x>a)&&(x<=b))
  15. if (x+b!=0)
  16. {
  17. y=a+pow(abs(log(b+x)),2);
  18. cout<<"y="<<y<<endl;
  19. } else cout<<"y=Error "<<endl;
  20. else
  21. {
  22. y=exp(a*x)+b;
  23. cout<<"y="<<y<<endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 4524KB
stdin
-1 -0.5 0
stdout
Input a,b,x
y=0.5