新手求解答,总显示出现一错误,看一下午了。。
#include<stdio.h>int main()
{
int I;
double bon1,bon2,bon4,bon6,bon10,bonus;
int branch;
bon1=100000*0.1;
bon2=bon1+100000*0.075;
bon4=bon2+200000*0.05;
bon6=bon4+200000*0.03;
bon10=bon6+400000*0.015;
printf("请输入总利润I=%d\n");
scanf("%d",&I);
branch=I/100000;
if (branch>10) branch=10;
switch(branch)
{
case 0:bonus=I*0.1;break;
case 1:bonus=bon1+(I-100000)*0.075;break;
case 2:
case 3:bonus=bon2+(I-200000)*0.05;break;
case 4:
case 5:bonus=bon4+(I-400000)*0.03;break;
case 6:
case 7:
case 8:
case 9:bonus=bon6+(I-600000)*0.015;break;
case 10:bonus=bon10+(I-1000000)*0.001;
}
printf("奖金bonus=%10.2f\n",bonus);
return 0;
}