请使用“答题”菜单或使用VC6打开考生文件夹下的工程proj3,其中声明了List类,它是一个用于表示整数列表的类。List的成员函数insert的功能是将一个指定的整数插入到列表的指定位置处,原位置处的及其后的所有元素依次向后顺移一个位置。请补充完整成员

admin2021-06-10  37

问题 请使用“答题”菜单或使用VC6打开考生文件夹下的工程proj3,其中声明了List类,它是一个用于表示整数列表的类。List的成员函数insert的功能是将一个指定的整数插入到列表的指定位置处,原位置处的及其后的所有元素依次向后顺移一个位置。请补充完整成员函数insert。在main函数中给出了一组测试数据,此情况下程序的输出应该是:
    5  3  7  9  13  2  6  8  1  0
    5  3  7  13  2  6  8  1  0
    5  -23  3  7  13  2  6  -19  8  1  0
    注意:只需在//**********333**********和//**********666**********之间填入所编写的若干语句,不要改动程序中的其他内容。
    #include”List.h“
    int main(){
    int dat[]={5,3,7,9,13,2,6,8,1,0};
    List list(dat,10);
    list.show();
    list.remove(3);
    list.show();
    list.insert(-23,1);
    list.insert(-19,7);
    list.show();
    writeToFile("c:\\test\\");
    return 0:
  //proj3\list.cpp   
  #include"List.h"
  List::List(int d[],int size){
    int min=(MAX_SIZE>size?size:MAX_SIZE);
    for(int i=0;i=d
    count=min;
    }
    void List::insert(int data,int pos){
    //存储空间已满,无法增添新元素
    if(count>=MAX_SIZE)return;
    //指定的插入位置在最后元素之后,紧贴最后元素之后插入新元素。
    if(pos>=count){elem[count++]=data;return;}
    //指定的插入位置未超过最后元素处,须移动有关元素以便腾空指定的插入位置,然后插入新元素。
    //********333********
    //********666********
    }
    void List::remove(int pos){
    if(pos<0 || pos>=count)return;
    for(int i=pos;i=elem[i+1];
    count--:
    ;
    void List::show(ostream&os)const{
    for(int i=0;i<<";
    os<    }
    //proj3\list.h
    #include
    using namespace std;
    #define MAX_SIZE 100
    class List{
    int elem[MAX_SIZE];    //存放列表元素的数组
    int count;    //列表中元素的个数
    public:
    List():count(0){}
    List(int d[],int size);
    int size()const{return count;}
    //将数据元素data插入到位置pos处。注意第一个元素的位置是0。
    void insert(int data,int pos);
    //删除位置pos处的数据元素。
    void remove(int pos);
    //输出列表内容
    void show(ostream&os=cout)const;
    };
void writeToFile(const char*path);

选项

答案if(income<:2000)//如果收入小于2000 retum tax_payable; //直接tex_payable(初始代为零) if(taxable>lower_limits[i]){ //如果taXable(收入超出起征额的部分)大于lower_limits[i]阶段最低限额 tax_payable += (taxable — lower_limits[i])*rates[i]; //把起过阶段最低限额的部分乘以该阶段的税率后,加到tax_payable(个人所得税) tacable=lower_limits[i]; //把fower_limits[i]赋值于taxable }

解析 主要考查考生对成员函数的掌握情况,根据题目要求可知,完成计算应纳个人所得税额的成员函数get.TaxPayable,其中参数income为月收入。同时题目还表明:不超过2000元的所得不征收个人所得税。因此先用if语句判断是否要征收个人所得税。然后根据题目所给表格,来判断收入多少及应该收多少个人所得税。
转载请注明原文地址:https://jikaoti.com/ti/2Ch0FFFM
0

最新回复(0)