-4
我想问的是我的编码有一些缺失或我做错了吗?我正在计算员工工资。它可以编译并运行,但不会显示应该产生的输出。c编程功能来计算工资
我试图让出来是这样的:(例如输出的值)
请输入你的工资:1200
请输入公积金扣除persentage:11
你的公积金扣除$ 132.00
您的奖金(年薪的一半)$ 600.00
你的总收入为$ 1200.00- $ 132.00 + $ 6000.00 = $ 1668年.00
我的编码是这样的:
void BasicSalary(); //Ask user to enter basic salary.
void EPF(double); //To calculate the amount of employees evident fund (EPF) deduction from basic salary.
void CalculateBonus(double); //To calculate the amount of bonus. Assume bonus is half of basic salary.
double DisplayTotalPay(double,double); //To calculate the total pay after EPF deduction and bonus reward.
double salary,epf,totalepf,totalbonus;
int main()
{
void BasicSalary();
void EPF(double);
printf("\nYour EPF deduction is $%f ",totalepf);
printf("\nYour bonus (half of salary) is $%f ");
void CalculateBonus(double);
double DisplayTotalPay(double,double);
}
void BasicSalary()
{
printf("\nPlease enter your salary: ");
scanf("%f",&salary);
}
void EPF(double)
{
printf("\n\nPlease enter the percentage of EPF deduction: ");
scanf("%f",epf);
totalepf= (epf/100) * salary;
}
void CalculateBonus(double)
{
totalbonus = salary/2;
}
double DisplayTotalPay(double,double)
{
printf("\nYour total pay is $%f - $%f + $%f = $%f ", salary, totalepf, totalbonus, salary-totalepf+totalbonus);
}
寻求调试帮助的问题(“为什么这个代码不工作?”)必须包含所需的行为,特定的问题或错误以及在问题本身中重现问题所需的最短代码。没有明确问题陈述的问题对其他读者无益。 – Ari0nhh
'main'什么都不做。你有评论和函数原型,但没有代码。 – user3386109
我为forgor取消注释@ user3386109 – rees