帮我做一下这道题 C语言的

[复制链接]
查看11 | 回复3 | 2010-10-25 15:55:31 | 显示全部楼层 |阅读模式
某商场销售策略为某种商品的销售金额小于200元,没有折扣;销售金额在200到400之间(包括200元),折扣为0.98;销售金额在400到600之间(包括400元),折扣为0.95;销售金额在600到800之间(包括600元),折扣为0.90;销售金额在800到1000之间(包括800元),扣为0.85;销售金额在1000元以上(包括1000元),折扣为0.8;编程实现从键盘上输入商品的单价和数量,计算并输出该商品的销售金额(分别用if和switch语句实现)。

回复

使用道具 举报

千问 | 2010-10-25 15:55:31 | 显示全部楼层
#includemain(){ float sprice=0,sumprice=0; int num=0; printf("输入商品单价:\n"); scanf("%f",&sprice); flushall(); printf("输入商品数量:\n"); scanf("%d",&num); flushall(); sumprice=sprice*num; switch((int)(sprice)/200) { case 0:break; case 1:sumprice*=0.98;break; case 2:sumprice*=0.95;break; case 3:
回复

使用道具 举报

千问 | 2010-10-25 15:55:31 | 显示全部楼层
int main(){ float price = 0; float icnt = 0; float sum; int reduceId;printf("请输入单价和数量用空格隔开\n"); scanf("%f%f",&price,&icnt);
sum = price*icnt; if(sum
回复

使用道具 举报

千问 | 2010-10-25 15:55:31 | 显示全部楼层
#include #include int main(){
float money,realMoney,sum;
int number;
int i;
printf("please input the money and number(such as 35.8 10
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行