任务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
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

17通信权念念_38381517108

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值