解题思路:
注意事项:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double x,y;
cin>>x;
if(x<0)
y=fabs(x);
else if((x>=0)&&(x<2))
y=pow((x+1),0.5);
else if((x>=2)&&(x<4))
y=pow((x+2),5);
else if(x>=4)
y=2*x+5;
printf("%.2f",y);
}参考代码:
0.0分
0 人评分