简单啊
语句:
switch((int)(x+0.5))
{ case 1: y=a+b*x; break;
case 2: y=a–b*x;break;
case 3: y=a*b*x; break;
case 4: y=a/(b*x);break;
default: printf("x error. \n"); }
改:
int temp = (int)(x + 0.5);
if(temp == 1)
y=a+b*x;
else if(temp ==2)
y=a–b*x;
else if(temp == 3)
y=a*b*x;
else if(temp ==4)
y=a/(b*x);
else
printf("x error. \n");