又是用C的问题.天下奇才等高手你们都去哪了啊.我有好多问题啊
#include <stdio.h>
#include <stdlib.h>
main()
{
float data1,data2,total;
char op;
printf("please input the data1 ,op and data2:");
scanf("%f,%c,%f",&data1,&op,&data2);
switch(op)
{
case '+':total=data1+data2;break;
case '-':total=data1-data2;break;
case '*':total=data1*data2;break;
case '/': if(data2==0)
{
printf("error");
}
total=data1/data2;break;
}
printf("%6.2f",total);
getch();
}
为什么输入数据后的结果全是0.不能达到预期的结果!!!!!