您的位置:首页 > 其它

第3周项目1—个人所得税计算器(if语句)

2016-03-15 18:43 330 查看
/*

*Copyright(c) 2015.烟台大学计算机与控制工程学院

*ALL rights  reserved.

*文件名称:test.cpp

*作者:杨驰

*完成日期:2016年3月15日

*问题描述:编写选择结构程序,输入个人月收入总额,计算出他应缴税款和税后收入。

*问题输入:月收入13500

*问题输出:个人所得税1495元,税后收入12005元

*

*/

#include<iostream>
using namespace std;
int main()
{
double dSalary,dTax=0,dNetIncome=0;
cout<<"请输入您本月的收入总额:";
cin>>dSalary;
double t=0;
t=dSalary-3500;         //t=收入总额-3500
if(t<=0)
{
cout<<"您不需要缴税,您该努力工作了!!!"<<endl;
}
else

{
if(t<=1500)
dTax=t*0.03-0.0;
else if(t<=4500)
dTax=t*0.1-105;
else if(t<=9000)
dTax=t*0.2-555;
else if(t<=35000)
dTax=t*0.25-1005;
else if(t<=55000)
dTax=t*0.3-2755;
else if(t<=80000)
dTax=t*0.35-5505;
else
dTax=t*0.45-13505;
dNetIncome=dSalary-dTax;
cout<<"您本月应缴个人所得税"<<dTax<<"元,税后收入是"<<dNetIncome<<"元。"<<endl;
}
cout<<"谢谢使用!"<<endl;
return 0;
}


运行结果:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: