无法通过C

时间:2018-03-31 13:47:23

标签: c windows

int main() {
setvbuf(stdout, NULL, _IONBF, 0);
char ch;
float price, amount;


printf("Enter price: $");
scanf("%f", &price);
amount = price * 0.9;
printf("Early payment (Y/N): ");
scanf("%c", &ch);

if(ch == 'n')
{
  printf("Amount due: $%0.2f\n", price);
}
else{
    printf("Amount due: $%0.2f\n", amount);
}
return 0;}

它打印一切都很好但完全跳过char输入部分..并以某种方式显示数量。谁能指出错误。谢谢!

0 个答案:

没有答案