问题遇到的现象和发生背景
vc++2010学习版用switch语句写一个工资薪水提成的执行答案不对 大一刚学整懵了
用代码块功能插入代码,请勿粘贴截图
#include<stdio.h>
#include<stdlib.h>
int main()
{ int sale,total;
printf("请输入销售额");
scanf("%f" ,&sale);
switch((sale/10000))
{case 0:
total=1000;
break;
case 1:
total=1000+(sale-10000)*0.05;
break;
case 2:
total=1000+500+(sale-20000)*0.06;
break;
case 3:
case 4:
case 5:total=1000+500+1800+(sale-50000)*0.07;
break;
case 6:
case 7:
case 8:
case 9:
case 10:total=1000+500+1800+3500+(sale-100000)*0.08;
break;
}
printf("total=%d");
system("pause");
}