已知某公司员工的工资底薪为500,员工销售的软件金额与提成方式如下: 销售额 ≤2000 没有提成 2000 < 销售额 ≤ 5000 提成8% 5000 < 销售额 ≤ 10000 提成10% 销售额 ≥ 10000 提成12%
#include <stdio.h>
int main(int argc, const char * argv[]) {
int sale, num;
int salary = 500;
printf("请输入你的销售额:\n");
scanf("%d",&sale);
if (sale / 1000 == 0) {
num = sale /1000;
}else num = sale + 1;
switch (num) {
case 0:
case 1:
case 2: printf("你的工资为:%d",salary); break;
case 3:
case 4:
case 5: printf("你的工资:%.2f",salary+sale*0.08);break;
case 6:
case 7:
case 8:
case 9:
case 10: printf("你的工资:%.2f",salary+sale*0.1);break;
default: printf("你的工资:%.2f",salary+sale*0.12);break;
}
return 0;
}
|
|