# 任务8

#include<stdio.h>
typedef struct wage
{
char name[20];
int nowwage,taxwage;
}wage;
int jisuantax(wage*wagestaff,int N)
{
int i,judge;
double tax=0.00;
for(i=0;i<N;i++)
{
judge = wagestaff[i].nowwage - 3500;
if (judge > 1500)
{
tax += (double)(judge - 1500) * 0.1;
judge = 1500;
}
if (judge > 3500)
{
tax += (double)(judge - 4500) * 0.2;
judge = 4500;
}
if (judge> 9000)
{
tax += (double)(judge - 9000) * 0.25;
judge = 9000;
}
if (judge > 35000)
{
tax += (double)(judge - 35000) * 0.3;
judge = 35000;
}
if (judge> 55000)
{
tax += (double)(judge- 55000) * 0.35;
judge = 55000;
}
if (judge > 80000)
{
tax += (double)(judge - 80000) * 0.45;
judge= 80000;
}
tax += (double)judge * 0.03;
wagestaff[i].taxwage= wagestaff[i].nowwage- (int)tax;
}
return 0;
}
int outwage(wage *wagestaff,int N)
{
int i;
for (i = 0; i < N; i++)
{
printf("%s: %d\n", wagestaff[i].name,wagestaff[i].taxwage);
}
}

int main()
{
int N, i;//N指员工的个数
wage *wagestaff;
printf("输入员工个数:");
scanf("%d", &N);
wagestaff = (wage*)malloc(sizeof(wage) * N);
//定义一个int类型的指针变量N,并申请N*sizeof(int)个字节(即4*N个字节)的存储空间
printf("输入每个员工的姓名，工资:\n");
for (i = 0; i < N; i++) {
scanf("%s", &wagestaff[i].name);
scanf("%d", &wagestaff[i].nowwage);
}
jisuantax(wagestaff,N);//计算个人所得税
outwage(wagestaff,N);//输出税后工资
return 0;
}
• 1
点赞
• 0
评论
• 0
收藏
• 打赏
• 扫一扫，分享海报

11-21 3861

01-20 8118
08-24 5361
01-18
08-03

17通信权念念_38381517108

¥2 ¥4 ¥6 ¥10 ¥20

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。