c++第3次实验

来源:互联网 发布:c语言99乘法表的输出 编辑:程序博客网 时间:2024/05/18 08:18
一、问题及代码
#include <iostream>using namespace std;int main(){    double dSalary,dTax=0,dNetIncome=0;    cout<<"您本月的收入金额(元):";    cin>>dSalary;    double Spare,TaxRate;    int deduction;    Spare=dSalary-3500;    if(Spare>0) {    if(Spare<=1500)        TaxRate=0.03,deduction=0;        else if(Spare<=4500)        TaxRate=0.10,deduction=105;    else if(Spare<=9000)        TaxRate=0.20,deduction=555;    else if(Spare<=35000)        TaxRate=0.25,deduction=1005;    else if(Spare<=55000)        TaxRate=0.30,deduction=2755;    else if(Spare<=80000)        TaxRate=0.35,deduction=5505;    else        TaxRate=0.45,deduction=13505; } else {  TaxRate=0;  deduction=0; } dTax=Spare*TaxRate-deduction; dNetIncome=dSalary-dTax; cout<<"您本月应缴个人所和税 "<<dTax<<" 元,税后收入是 "<<dNetIncome<<" 元。\n";    return 0;}
二、运行结果

三、心得体会

第三次实验的作业,做完之后要经过多次修改才能正常运行,以后要多注意细节。


0 0
原创粉丝点击