谁帮我看下这个程序为什么输出总是0.00啊

[复制链接]
查看11 | 回复3 | 2013-3-22 15:57:43 | 显示全部楼层 |阅读模式
程序已修改,请看程序注释:#includeint main(void){ const float s=3.5; const float l=5.5; int a; float b; printf("please input your edition(1 or 2):"); scanf("%d",&a); printf("please input your amount:"); scanf("%f",&b);//将 scanf("%d",&b);改为 scanf("%f",&b);即可 if(a==1) printf("1ed need to pay %.2f dollars\n.",...
回复

使用道具 举报

千问 | 2013-3-22 15:57:43 | 显示全部楼层
你需要把scanf("%d",&b)中的d改成f...
回复

使用道具 举报

千问 | 2013-3-22 15:57:43 | 显示全部楼层
scanf("%d",&b)b是浮点型,要用scanf("%f",&b)...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行