代码如下:
double fun(double x)
{
if(x<0 && x!=-3)
return x*x+x+6;
if(x>=0 && x<10 && x!=2 && x!=3)
return x*x-5*x+6;
else
return x*x-x-1;
}
float fun(float x)
{
if(x<0 && x!=-3)
return x*x+x+6;
if(x>=0 && x<10 && x!=2 && x!=3)
return x*x-5*x+6;
return x*x-x-1;
}