首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
请使用“答题”菜单或使用VC6打开考生文件夹下的工程proj3,其中声明了List类,它是一个用于表示整数列表的类。List的成员函数insert的功能是将一个指定的整数插入到列表的指定位置处,原位置处的及其后的所有元素依次向后顺移一个位置。请补充完整成员
请使用“答题”菜单或使用VC6打开考生文件夹下的工程proj3,其中声明了List类,它是一个用于表示整数列表的类。List的成员函数insert的功能是将一个指定的整数插入到列表的指定位置处,原位置处的及其后的所有元素依次向后顺移一个位置。请补充完整成员
admin
2021-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
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下类定义classAnimal{public;virtualvoidName()=0;};classKoala:publicAnimal{public:voidName(){
有如下类定义:classB{public:voidfun1(){}private:voidfun2(){}protected:voidfun3(){}};classD:publicB{
有如下程序:#include<iostream>usingnamespacestd;classPublication{//出版物类charname[30];Publication(char*nam
对虚函数的调用()。
使用VC6打开考生文件夹下的源程序文件modi3.cpp,通过把类Distance定义为类Point的友元类,来实现计算两点之间距离的功能。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。(1)把类CDistance定义为类CPoint的友
请使用VC6或使用【答题】菜单打开考生目录proj3下的工程文件proj3,此工程中包含一个源程序文件proj3.cpp,其功能是从文本文件in.dat中读取全部整数,将整数序列存放到intAn’ay类的对象中,然后建立另一对象myArray,将对象内容赋
使用VC6打开考生文件夹下的源程序文件modi3.cpp,其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。(1)定义类CPlanet的保护数据成员distance和revolvePeriod,它们分别表示行星距太阳的距离和行星的公转
在数据管理技术发展的三个阶段中,数据共享最好的是()。
下列数据结构中,属于非线性结构的是()。
下列关于运算符函数的描述中,错误的是()。
随机试题
设z=x2f(),且f可微,求dz.
决定硬膜外阻滞平面的最主要因素是_____。
碘解磷定
某仲裁机构对甲公司与乙公司之间的合同纠纷进行裁决后,乙公司不履行仲裁裁决。甲公司向法院申请强制执行,乙公司申请法院裁定不予执行。经审查,法院认为乙公司的申请理由成立,裁定不予执行该仲裁裁决。对此,下列说法错误的是:()
求取土地收益及确定()是收益还原法的关键。
净化空调系统的终端过滤设备和净化设备的核心是()。
会计记录所使用的文字只能是中文,不允许使用民族文字或外国文字。()
著作权中,()的保护期不受限制。
结合我省实际,谈谈如何进行依法治省?
--Wouldyouliketogopicnickingwithustoday?--______,butitlookslikerain.
最新回复
(
0
)