guozi6

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  193 随笔 :: 0 文章 :: 1 评论 :: 3715 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

 

#include<iostream>
#define TAXBASE 3500
using namespace std;
typedef struct{
long start;
long end;
double taxrate;
}TAXTABLE;
TAXTABLE taxtable[]={{0,1500,0.03},{1500,4500,0.10},{4500,9000,0.20},{9000,35000,0.25},{35000,55000,0.30},{55000,80000,0.35},{80000,1e10,0.40}};
double caculatetax(long profit)
{
int i;
double tax=0.0;
profit=profit-TAXBASE;
for(i=0;i<sizeof(taxtable)/sizeof(TAXTABLE);i++)
{
if(profit>taxtable[i].start)
{
if(profit>taxtable[i].end)
{
tax+=(taxtable[i].end-taxtable[i].start)*taxtable[i].taxrate;
}
else
{
tax+=(profit-taxtable[i].start)*taxtable[i].taxrate;
}
profit-=taxtable[i].end;
if(profit<0)
profit=0;
cout<<"征税范围:"<<taxtable[i].start<<endl;
cout<<"该范围内缴税金额:"<<taxtable[i].end<<endl;
cout<<"超出该范围的金额:"<<tax<<endl;

}

}
return tax;
}

int main()
{
long profit;
double tax;
cout<<"请输入个人收入金额:";
cin>>profit;
tax=caculatetax(profit);
cout<<"您的个人所得税为:"<<tax<<endl;
}

 

posted on   汀幻  阅读(14)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示