为什么只有第三个scanf不运行?新手求教
#include<stdio.h>int main()
{
char goods[20],c[3];
int num,total;
float price,sum,in;
printf("----------------欢迎使用数字购物清单------------------\n");
do{
printf("请输入商品名称:\n");
scanf("%s",&goods);
printf("请输入商品价格:\n");
scanf("%4.2f",&price);
printf("请输入商品数量:\n");
scanf("%d",&num);
printf("小计\n数量:%d\t金额:%4.2f\n",total+=num,sum+=(price*num));
printf("是否继续录入?\n输入yes继续,no结算\n");
scanf("%s",c);
}while(strcmp(c,"yes")==0);
printf("合计\n数量:%d\t金额%4.2f\n",total,sum);
printf("请输入实收金额:\n");
scanf("%4.2f",&in);
printf("应收:%4.2f\t实收:%4.2f\n",total,in);
if(in>total){
printf("找零:%4.2f",in-total);
}
else{
printf("对不起,需补款:%4.2f",total-in);
}
return 0;
}