用C++写一个 个人所得税计算器
时间: 2023-11-24 18:07:52 浏览: 80
好的,我可以帮您实现这个功能。以下是C语言代码示例:
#include <stdio.h>
int main() {
float income, tax;
printf("请输入您的税前收入:");
scanf("%f", &income);
if (income <= 0) {
printf("请输入正确的收入金额!\n");
return 0;
}
if (income <= 36000) {
tax = income * 0.03;
} else if (income <= 144000) {
tax = (income - 36000) * 0.1 + 2520;
} else if (income <= 300000) {
tax = (income - 144000) * 0.2 + 16920;
} else if (income <= 420000) {
tax = (income - 300000) * 0.25 + 31920;
} else if (income <= 660000) {
tax = (income - 420000) * 0.3 + 52920;
} else if (income <= 960000) {
tax = (income - 660000) * 0.35 + 85920;
} else {
tax = (income - 960000) * 0.45 + 181920;
}
printf("您的应纳税额为:%.2f元\n", tax);
printf("税后收入为:%.2f元\n", income - tax);
return 0;
}
提示:个人所得税的计算方法可能会受到政策和规定的影响,以上代码仅供参考。
阅读全文