做了个SWITCH 选择结构,但有错误?求破
#include<stdio.h>
int main()
{int k;
scanf("%d",&k);
printf ("输入需要计算的值\n");
double a, b, result;
scanf("%lf%lf",&a,&b);
switch( k)
{
case 1: result=a+b; break;
case 2: result=a-b; break;
case 3: result=a*b; break;
case 4: result=a/b; break;
}
printf("%lf\n",result);
return 0;}