| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 681 人关注过本帖
标题:求C语言编程,急切
只看楼主 加入收藏
seyeboy
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2011-6-26
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:15 
求C语言编程,急切
工资纳税系统编程:
个人所得税每月交一次,底线是1600元/月,也就是超过了1600元的月薪才开始计收个人所得税。个人所得税税率表一(工资、薪金所得适用)
级数----------全月应纳税所得额----------税率(%)
1--------------不超过500元的--------------------------5
2----------超过500元至2000元的部分------------10
3----------超过2000元至5000元的部分----------15
4----------超过5000元至20000元的部分---------20
5----------超过20000元至40000元的部分-------25
6----------超过40000元至60000元的部分-------30
7----------超过60000元至80000元的部分-------35
8----------超过80000元至100000元的部分------40
9----------超过100000元的部分---------------------45
表中的应纳税所得额是指以每月收入额减除1600元后的余额。
例如:计算为:2500-1600=900
应纳个人所得税额=500×5%+400×10% =65
再比如:我们用一个大额工资计算,25000元
应纳税所得额=25000-1600=23400
应纳个人所得税税额=500×5%+1500×10%+3000×15%+15000×20%+3400×25%=4475
要求:
(1)职工信息输入、修改、查询;
(2)职工工资录入;
(3)计算出纳税金额;
(4)按工资排序输出所有职工工资报表;
(5)输入职工代号,输出个人工资条;


有个程序但老出错,麻烦哪位大鸟看看那:
#include  <iostream>
using namespace std;
class Fack
{
public:
 ////////////////////
 Fack(){ns = 0; q=0;}
 ~Fack(){}
 ///////////////////
 //float fun(float&); float fun();
 void display();
 /////////////
 void setns(float&);
 /////////////
private:
 float gongzi;//公民工资
 float ns;//纳税的款
 float q;//需要纳税的部分
};
void Fack::setns(float &gz)
{
 //cout<<"欢迎来到纳税系统!"<<endl;
 //cout<<"请输入您要纳税的工资:";
 //cin>>gongzi;
 gongzi=gz;
}
//float Fack::fun(float &gongzi)
float Fack::fun()
{
 q=gongzi-1600;
 if(q<=0)
   return ns;
  else
  {
   if(q<=500){
   ns=q*0.05;}
   else
   {
    if(q>500&&q<=2000){
     ns=25+(q-500)*0.1;}
    else
    {
     if(q>2000&&q<=5000){
      ns=25+150+(q-2000)*0.15;}
     else
     {
      if(q>5000&&q<=20000){
       ns=25+150+450+(q-5000)*0.2;}
      else
      {
       if(q>20000&&q<=40000){
        ns=25+150+450+3000+(q-20000)*0.25;}
       else
       {
        if(q>40000&&q<=60000){
         ns=25+150+450+3000+5000+(q-40000)*0.3;}
        else
        {
         if(q>60000&&q<=80000){
                                  ns=25+150+450+3000+5000+6000+(q-60000)*0.35;}
         else
         {
          if(q>80000&&q<=100000){
           ns=25+150+450+3000+5000+6000+7000+(q-80000)*0.4;}
          else
          {
           if(q>100000){
            ns=25+150+450+3000+5000+6000+7000+8000+(q-100000)*0.45;}
          }
         }
        }
       }
      }
     }
    }
   }
  }
  return 0;
}
void Fack::display()
{
    cout<<"您需要被政府抢走的劳动报酬是:"<<ns<<endl;
}
int main()
{
    Fack b;
 float a;
 cout<<"欢迎来到纳税系统!"<<endl;
 cout<<"如果需要退出,请按0!"<<endl;
 while (a != 0){
 cout<<"请输入您要纳税的工资:"<<endl;
 cin>>a;
 b.setns(a);
 b.fun();
 b.display();
 }
 return 0;
}

搜索更多相关主题的帖子: C语言 
2011-06-26 10:40
hjywyj
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:3
帖 子:1114
专家分:2611
注 册:2010-4-14
收藏
得分:1 
用switch
2011-06-26 10:48
seyeboy
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2011-6-26
收藏
得分:0 
懂的大鸟看看程序呗
2011-06-26 10:51
lz1091914999
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:四川
等 级:贵宾
威 望:37
帖 子:2011
专家分:5959
注 册:2010-11-1
收藏
得分:14 
程序代码:
#include <stdio.h>

int main(void) {
    int salary, pit = 0;
    scanf("%d", &salary);
    if(salary - 1600 > 0) {
        if(salary - (1600 + 500) > 0) {
            if(salary - (1600 + 2000) > 0) {
                if(salary - (1600 + 5000) > 0) {
                    if(salary - (1600 + 20000) > 0) {
                        if(salary - (1600 + 40000) > 0) {
                            if(salary - (1600 + 60000) > 0) {
                                if(salary - (1600 + 80000) > 0) {
                                    if(salary - (1600 + 100000) > 0) {
                                        pit += 500 * 0.05;
                                        pit += 1500 * 0.1;
                                        pit += 3000 * 0.15;
                                        pit += 15000 * 0.2;
                                        pit += 20000 * 0.25;
                                        pit += 20000 * 0.3;
                                        pit += 20000 * 0.35;
                                        pit += 20000 * 04;
                                        pit += (salary - (1600 + 100000)) * 0.45;
                                    } else {
                                        pit += 500 * 0.05;
                                        pit += 1500 * 0.1;
                                        pit += 3000 * 0.15;
                                        pit += 15000 * 0.2;
                                        pit += 20000 * 0.25;
                                        pit += 20000 * 0.3;
                                        pit += 20000 * 0.35;
                                        pit += (salary - (1600 + 80000)) * 0.4;
                                    }
                                } else {
                                    pit += 500 * 0.05;
                                    pit += 1500 * 0.1;
                                    pit += 3000 * 0.15;
                                    pit += 15000 * 0.2;
                                    pit += 20000 * 0.25;
                                    pit += 20000 * 0.3;
                                    pit += (salary - (1600 + 60000)) * 0.35;
                                }
                            } else {
                                pit += 500 * 0.05;
                                pit += 1500 * 0.1;
                                pit += 3000 * 0.15;
                                pit += 15000 * 0.2;
                                pit += 20000 * 0.25;
                                pit += (salary - (1600 + 40000)) * 0.3;
                            }
                        } else {
                            pit += 500 * 0.05;
                            pit += 1500 * 0.1;
                            pit += 3000 * 0.15;
                            pit += 15000 * 0.2;
                            pit += (salary - (1600 + 20000)) * 0.25;
                        }
                    } else {
                        pit += 500 * 0.05;
                        pit += 1500 * 0.1;
                        pit += 3000 * 0.15;
                        pit += (salary - (1600 + 5000)) * 0.2;
                    }
                } else {
                    pit += 500 * 0.05;
                    pit += 1500 * 0.1;
                    pit += (salary - (1600 + 2000)) * 0.15;
                }
            } else {
                pit += 500 * 0.05;
                pit += (salary - (1600 + 500)) * 0.1;
            }
        } else {
            pit += (salary - (1600)) * 0.05;
        }
    }
    printf("%d\n", pit);
    return 0;
}

My life is brilliant
2011-06-26 10:51
seyeboy
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2011-6-26
收藏
得分:0 
------------------Configuration: Cpp3 - Win32 Debug--------------------
Compiling...
Cpp3.cpp
F:\新建文件夹\Cpp3.cpp(15) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(16) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(17) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(18) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(19) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(20) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(21) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(23) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(25) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(26) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(27) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(28) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(29) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(30) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(31) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(32) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(35) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(36) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(37) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(38) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(39) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(40) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(41) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(44) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(45) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(46) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(47) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(48) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(49) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(52) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(53) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(54) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(55) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(56) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(59) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(60) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(61) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(62) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(65) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(66) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(67) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(70) : warning C4244: '+=' : conversion from 'const double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(71) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
F:\新建文件夹\Cpp3.cpp(74) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data

Cpp3.obj - 0 error(s), 44 warning(s)


这是怎么回事哈?
2011-06-26 10:58
hjywyj
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:3
帖 子:1114
专家分:2611
注 册:2010-4-14
收藏
得分:2 
回复 5楼 seyeboy
把int改为float试试

[ 本帖最后由 hjywyj 于 2011-6-26 11:00 编辑 ]
2011-06-26 10:59
lz1091914999
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:四川
等 级:贵宾
威 望:37
帖 子:2011
专家分:5959
注 册:2010-11-1
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

我怎么没问题啊?

My life is brilliant
2011-06-26 11:00
seyeboy
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2011-6-26
收藏
得分:0 

不会写哈,哪位高手帮帮看哈?
2011-06-26 11:01
seyeboy
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2011-6-26
收藏
得分:0 
我的是Vicusal C++ 6.0 环境的
2011-06-26 11:03
hjywyj
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:3
帖 子:1114
专家分:2611
注 册:2010-4-14
收藏
得分:3 
回复 9楼 seyeboy
楼主可以改为double或float型来输入输出且计算
2011-06-26 11:05
快速回复:求C语言编程,急切
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.076320 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved