困扰了好几天的 scanf 输入函数应用
程序代码:#include<stdio.h>
#include<stdlib.h>
int main(viod)
{
double price,discount,new_discount;
float cost_discount=0.38;
printf("产品价格 :");
scanf("%d",&price);//getchar();
printf("产品折扣 :");
scanf("%f",&discount);//getchar();
printf("产品价格是%d,折扣是%.2f,成本折扣是%f.\n",price,discount,discount-cost_discount);
double profit=price*(discount-cost_discount);
printf("产品利润是%d:\n",profit);
printf("产品新折扣是 :");//getchar();
scanf("%f",&new_discount);
double profit1=price*(new_discount-cost_discount);
if(profit>=profit1)
printf("前数量= %d 数量.\n",profit/profit1);
else
printf("亏本.\n");
system("pause");
return 0;
}算出来的结果不对,是scanf函数调入了什么,请各位帮忙指正那里错了,谢谢!









