#include<stdio.h>
#include<stdlib.h>
typedef struct {
char name[20];
char id[30];
int nowWages, taxWages;/*表示税前工资和税后工资*/
}wage;
int calcuTax(wage *wagesData,int N)
{
int jud, i;
double tax = 0.0;
for (i = 0; i < N; i++) {
jud = wagesData[i].nowWages - 3500;
if (jud > 80000) {
tax += (double)(jud - 80000) * 0.45;
jud = 80000;
}
if (jud > 55000) {
tax += (double)(jud - 55000) * 0.35;
jud = 55000;
}
if (jud > 35000) {
tax += (double)(jud - 35000) * 0.3;
jud = 35000;
}
if (jud > 9000) {
tax += (double)(jud - 9000) * 0.25;
jud = 9000;
}
if (jud > 4500) {
tax += (double)(jud - 4500) * 0.2;
jud = 4500;
}
if (jud > 1500) {
tax += (double)(jud - 1500) * 0.1;
jud = 1500;
}
tax += (double)jud * 0.03;
wagesData[i].taxWages = wagesData[i].nowWages - (int)tax;
}
return 0;
}
int oupWages(wage *wagesData,int N)
{
int i;
for (i = 0; i < N; i++) {
printf("%s: %d\n", wagesData[i].name,wagesData[i].taxWages);
}
}
int main()
{
int N, i;
wage *wagesData;
printf("输入员工个数:");
scanf("%d", &N);
wagesData = (wage*)malloc(sizeof(wage) * N);
printf("依次输入每个员工的姓名,工资:\n");
for (i = 0; i < N; i++) {
scanf("%s", &wagesData[i].name);
scanf("%d", &wagesData[i].nowWages);
}
calcuTax(wagesData,N);
oupWages(wagesData,N);
system("pause");
return 0;
}
收入与纳税计算
最新推荐文章于 2022-12-12 16:09:39 发布