69,382
社区成员
发帖
与我相关
我的任务
分享
#include<stdio.h>
int main()
{
int c;
long i;
float y,x1,x2,x4,x6,x10;
x1=100000*0.1;
x2=x1+100000*0.075;
x4=x2+200000*0.05;
x6=x4+200000*0.03;
x10=x6+400000*0.015;
printf("请输入利润:");
scanf("%ld",&i);
c=i/100000;
if(c>10)
c=10;
switch(c)
{
case 0:y=i*0.1;
printf("case 0\n"); //here output to see
break;
case 1:y=x1+(i-100000)*0.075;
printf("case 1\n");//here output to see
break;
case 2:
case 3:y=x2+(i-200000)*0.05;break;
case 4:
case 5:y=x4+(i-400000)*0.03;break;
case 6:
case 7:
case 8:
case 9:y=x6+(i-600000)*0.015;break;
case 10:y=x10+(i-1000000)*0.01;
}
printf("利润是:%ld,奖金是:%.1f\n",i,y);
system("pause");
return 0;
}
//至少我的没有问题,有的可能是你的编译器的问题吧。