C++控制台计算个人所得税? 计算个人所得税c语言编程

2677℃ SARAH

C++控制台计算个人所得税?计算个人所得税c语言编程

用C#控台应用程序编写一个计算个人所得税的程序,具体要求如下,谢谢

decimal CalTax(decimal totalIncome)

{

decimal tax, income;

if(totalIncome <= 1600)

tax = 0;

else

{

income = totalIncome - 1600;

if(income <= 500)

tax = income * 0.05;

else

if(income <= 2000)

tax = 500 * 0.05 + (income - 500) * 0.1;

else

if(income <= 5000)

tax = 500 * 0.05 + 1500 * 0.1 + (income - 2000)* 0.15;

else

if(income <= 20000)

tax = 500 * 0.05 + 1500 * 0.1 + 3000 * 0.15 + (income - 5000)* 0.2;

else

//以下类似......

}

return tax;

}

我百度到的……

C语言计算个人所得税 编程

#include "stdio.h"

int main(void){

    double s,rs,rat;

    printf("Enter your number should get salary...\ns=");

    scanf("%lf",&s);

    if(rs=s-2000,rs<500)

        rat=0.05;

    else if(rs>=500 && rs<2000)

        rat=0.1;

    else if(rs>=2000 && rs<5000)

        rat=0.15;

    else if(rs>=5000 && rs<20000)

        rat=0.2;

    else if(rs>=20000 && rs<40000)

        rat=0.25;

    else if(rs>=40000 && rs<60000)

        rat=0.3;

    else if(rs>=60000 && rs<80000)

        rat=0.35;

    else if(rs>=80000 && rs<100000)

        rat=0.4;

    else if(rs>=100000)

        rat=0.45;

    printf("Your SGS: %.2f\tTAX: %.2f\tAGS:%.2f\n",s,rat*rs,s-rat*rs);

    return 0;

}

编写计算个人所得税的c语言源程序代码及流程图

#include

#define TAXBASE 2000

typedef struct{

long base;

long limit;

double taxrate;

}TAXTABLE;

TAXTABLE TaxTable[] = {\

{0, 500, 0.05},\

{500, 2000, 0.10},\

{2000, 5000, 0.15},\

{5000, 20000, 0.20},\

{20000, 40000, 0.25},\

{40000, 60000, 0.30},\

{60000, 80000, 0.35},\

{80000, 100000, 0.40},\

{100000,1e10, 0.45},\

};

double CaculateTax(long profit)

{

int i;

double tax = 0.0;

profit -= TAXBASE;

for(i=0; i< sizeof(TaxTable)/sizeof(TAXTABLE); i++)

{

if( profit > TaxTable[i].base )

{

if( profit > TaxTable[i].limit )

{

tax += (TaxTable[i].limit - TaxTable[i].base) * TaxTable[i].taxrate;

}

else

{

tax += (profit - TaxTable[i].base) * TaxTable[i].taxrate;

}

profit -= TaxTable[i].limit;

printf("Base%d:%6ld Limit%d:%6ld Tax:%12.2f Leave:%6ld\n",i,TaxTable[i].base,i,\

TaxTable[i].limit, tax, (profit)>0 ? profit : 0);

}

}

return tax;

}

int main(void)

{

long profit;

double tax;

printf("Please enter your profit:");

scanf("%ld",&profit);

tax = CaculateTax(profit);

printf("Tax is: %12.2f\n",tax);

return 0;

}

C++一个算个人所得税的程序

#include

int main(void)

{

int x;

double y;

printf("请输入你的工资薪金总和:");

scanf("%d",&x);

if(x<=1600)

{

printf("您不需要交纳所得税");

}

else

if(x>1600&&x<=2100)

{

y=(x-1600)*0.05;

printf("%lf",y);

}

else

if(x>2100&&x<=3600)

{

y=(x-2100)*0.1+25;

printf("%lf",y);

}

else

if(x>3600&&x<=6600)

{

y=(x-3600)*0.15+150+25;

printf("%lf",y);

}

else

if(x>6600&&x<=21600)

{

y=(x-6600)*0.2+450+200+25;

printf("%lf",y);

}

else

if(x>21600&&x<=41600)

{

y=(x-21600)*0.25+3000+450+200+25;

printf("%lf",y);

}

else

if(x>41600&&x<=61600)

{

y=(x-41600)*0.3+5000+3000+450+200+25;

printf("%lf",y);

}

else

if(x>61600&&x<=81600)

{

y=(x-61600)*0.35+6000+5000+3000+450+200+25;

printf("%lf",y);

}

else

if(x>81600&&x<=101600)

{

y=(x-81600)*0.4+7000+6000+5000+3000+450+200+25;

printf("%lf",y);

}

else

{y=(x-101600)*0.45+8000+7000+6000+5000+3000+450+200+25;

printf("%lf",y);

}

return 0;

}

现在就可以了,我把x定义为int类型