#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int number,price,result,m,n;/*定义变量*/
printf("请输入客户购买笔袋的数量:");
scanf("%d",&number);/*输入客户购买数量*/
m=number/50;
n=number/100;
switch(number>0)
{
case 1:switch(m)
{
case 0:price=38;break;
case 1:price=35;break;
}break;
case 0:switch(n)
{
case 1:price=32;break;
case 2:price=30;break;
default:price=28;break;
}break;
default:printf("你输入的数量不在范围内\n");
}
result=number*price;
printf("总金额为:%d\n",result);
system("PAUSE");
return 0;
}
转载于:https://www.cnblogs.com/hgr123456/p/6682294.html