#include
int main()
{double x,y=0;
scanf("%lf",&x);
if(x>1000000){y=(x-1000000)*0.001; x=1000000;}
if(x>600000){y+=(x-600000)*0.015; x=600000;}
if(x>400000){y+=(x-400000)*0.03; x=400000;}
if(x>200000){y+=(x-200000)*0.05; x=200000;}
if(x>100000){y+=(x-100000)*0.075; x=100000;}
y+=x*0.1;
printf("%g\n",y);
return 0;
}
手打c++代码,已经验证。参数如果有变化直接修改数组的值就可以了。
#include
using namespace std;
double culPrize(double realProfit ,double (&profit)[6], double (&percentage)[5])
{
double prize = 0;
for (int i = 1; i < 6; i++)
{
if (realProfit < profit[i])
{
prize += (realProfit - profit[i - 1]) * percentage[i - 1];
break;
}
else
prize += (profit[i] - profit[i-1]) * percentage[i - 1];
}
return prize;
}
int main()
{
double profit[] = {0, 100000, 200000, 400000, 600000, 1000000 };
double percentage[] = { 0.1, 0.075, 0.05, 0.015, 0.01 };
int realProfit = 0;
cin >> realProfit;
double prize = culPrize(realProfit, profit, percentage);
cout << "the prize of " << realProfit << " is " << "" << prize << endl;
system("PAUSE ");
}
#include
using namespace std;
int main()
{ double lirun,money;
cout<<"输入利润:";
cin>>lirun;
if(lirun<=10) money=lirun*0.1;
else if(lirun>10&&lirun<=20)
money=10*0.1+(lirun-10)*0.075;
else if(lirun>20&&lirun<=40)
money=10*0.1+10*0.075+(lirun-20)*0.05;
else if(lirun>40&&lirun<=60)
money=10*0.1+10*0.075+20*0.05+(lirun-40)*0.03;
else if(lirun>60&&lirun<=100)
money=10*0.1+10*0.075+20*0.05+20*0.03+(lirun-60)*0.015;
else
money=10*0.1+10*0.075+20*0.05+20*0.03+40*0.015+(lirun-100)*0.01;
cout<<"你当月提成为:"<return 0;
}
发到你的私信了。注意查收