#include
#include
int main()
{
int x,n;
double y;
printf("请输入x的值\n");
scanf("%d",&x);
if(x<2);
n=1;
if(x>=2&&x<6);
n=2;
if(x>=6&&x<10);
n=3;
if(x>=10);
n=4;
switch(n)
{
case 1:y=x;break;
case 2:y=x*x+1;break;
case 3:y=sqrt(x+1.0);break;
case 4:y=1/(x+1);
}
printf("y的值是:%lf\n",y);
return 0;
}
if语句后面的分号删掉