#include
#include
float function(char y,float x)
{
if (x <= 100000)
x = 0.1*x;
else if (100000 x = (x - 100000)*0.075 + 10000;
else if (200000 x = (x - 200000)*0.05 + 10000 + 7500;
else if (400000 x = (x - 400000)*0.03 + 6000 + 7500 + 10000;
else if (600000 x = (x - 600000)*0.015 + 10000 + 7500 + 6000;
else if (x>1000000)
x = (x - 1000000)*0.1 + 6000 + 6000 + 7500 + 10000;
printf("%c bonus is: %.2f\n", y, x);
}
int main(void)
{
float a, b, c, d,T;
char A, B, C, D,e,f,g;
printf("******Enterprise Interest Count******\n");
scanf("%c %f", &A,&a);
scanf("%c",&e);
scanf("%c %f", &B,&b);
scanf("%c",&f);
scanf("%c %f", &C,&c);
scanf("%c",&g);
scanf("%c %f", &D,&d);
printf("\n");
printf("******Enterprise Employee Bonus******\n");
function(A, a);
function(B, b);
function(C, c);
function(D, d);
T=a+b+c+d;
printf("THE TOTAL BONUS ARE:%.2f \n",T);
system("PAUSE ");
getchar();
return 0;
}
为什么abcd的值会没有变,还是原来的值。
c++的话
float function(char& y,float& x)
C的话,用指针
function中括号不匹配!!!
float function(char y,float &x) // 返回x的值。。还有请把 if else 的判断值写清楚。。。
{
if (x <= 100000)
x = 0.1*x;
else if (x > 100000 && x < 200000)
x = (x - 100000)*0.075 + 10000;