求高手解决一下下面的问题?#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_p

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 17:54:44

求高手解决一下下面的问题?#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_p
求高手解决一下下面的问题?
#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;
}
这个程序输不出来,求解?
在编译时出现错误,我觉的没有错误呀!但是显示错误,不知道为什么

求高手解决一下下面的问题?#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_p
C的话,把double total = 0.0;放到printf前面去,C只能在程序开头声明,我放在开头,可以运行