#include
#include
int main()
{
double x,y;
scanf("%lf",&x);
if(x<-1)
{
y=x;
}
else if(x<1)
{
y=pow(x,3);
}
else
{
y=exp(1-x);
}
printf("y=%lf\n",y);
return 0;
}
# include
# include
void main()
{
int x, y;
printf("请输入x的值:");
scanf("%d", &x);
if(x < -1)
y = x;
else if(-1 < xy = x*x*x;
else
y = exp(-x+1);
printf("y = %d", y);
}
#include
#include
int main(void)
{
float x=0.0, y=0.0;
scanf("%f", &x);
if (x < -1.0)
y = x;
else if (-1.0 < x && x < 1.0)
y = x*x*x;
else
y = pow(exp(1.0), -x+1.0);
printf("%0.2f\n", y);
}
#include
#include
double Fuc(double x)
{
if(x<-1)
{
return x;
}
else if(x>-1&&x<1)
{
return x*x*x;
}
else if(x>=1)
{
return exp(-x+1);
}
return 0;
}
int main()
{
double x,y;
scanf("%lf",&x);
y=Fuc(x);
printf("%lf",y);
return 0;
}