题目
求高手解决一下下面的问题?
#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 ", 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_price*0.95;
else
total = quantity*unit_price;
printf("The price for %d is $%.2f ", quantity, total);
return 0;
}
这个程序输不出来,求解?
在编译时出现错误,我觉的没有错误呀!但是显示错误,不知道为什么
提问时间:2020-11-06
答案
C的话,把double total = 0.0;放到printf前面去,C只能在程序开头声明,我放在开头,可以运行
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点
- 1若a、b为实数,且b=根号下a的平方-1加根号下1-a的平方除以a+7再+4,则a+b的值为
- 2a running race of about 26 miles 这句话什么意思
- 3《牢记历史,以史为鉴》第4题:其中风口浪尖是用来比喻( ),充分说明了( ).
- 4已知F1(-3,0)、F2(3,0)是椭圆x2/m+y2/n=1的两个焦点,p在椭圆上,∠F1PF2=а,且当а=2π/3时,三角形F1PF2面积最大,求椭圆的方程
- 5已知函数f(x)=2^x-1/2^lxl,(1)若f(x)=0求x的值(2)若对于t∈[1,2]时不等式2^tf(2t)+mf(t)≥0恒成立,
- 6虾皮和胆小用英语怎么说?
- 7命题“p或q ”是真命题,则正确的是:
- 8you are the first one touched my heart 的中文意思
- 9随风潜入夜 润物细无声表达作者什么的感情
- 10第二章 地球上的大气