求高手解决一下下面的问题?

求高手解决一下下面的问题?
#include
int main(void)
{
const double unit_price = 3.50;
int quantity = 0;
printf("Enter the number that you want to buy:");
scanf(" %d", &quantity);

double total = 0.0;
if(quantity > 10)
 total = quantity*unit_price*0.95;
else
total = quantity*unit_price;
printf("The price for %d is $%.2f\n", quantity, total);
return 0;
}
这个程序输不出来,求解?
在编译时出现错误,我觉的没有错误呀!但是显示错误,不知道为什么
其他人气:342 ℃时间:2020-05-20 07:23:01
优质解答
C的话,把double total = 0.0;放到printf前面去,C只能在程序开头声明,我放在开头,可以运行
我来回答
类似推荐
请使用1024x768 IE6.0或更高版本浏览器浏览本站点,以保证最佳阅读效果。本页提供作业小助手,一起搜作业以及作业好帮手最新版!
版权所有 CopyRight © 2012-2024 作业小助手 All Rights Reserved. 手机版