if...else 分支判断即可
float fun(float x)
{
if(x<=-5)
return x*x+x-1;
if(x>=5)
return x+6;
return pow(x,5);
}
float fun(float x)
{
float y;
if (x <= -5)
y = x*x+x-1;
else if (x > -5 && x <= 5)
y = pow(x,5) ;
else
y = x+6;
return y;
}
if(x<=-5)
return pow(x,2)+x-1;
else if(x>-5&&x<5)
return pow(x,5);
else
return x+6;