计算机类
公务员类
工程类
语言类
金融会计类
计算机类
医学类
研究生类
专业技术资格
职业技能资格
学历类
党建思政类
计算机等级考试(NCRE)
全国计算机应用水平考试(NIT)
计算机软件水平考试
计算机等级考试(NCRE)
全国高校计算机等级考试CCT
行业认证
信息素养
计算机等级考试二级
计算机等级考试一级
网络工程师(计算机等级考试四级)
计算机等级考试二级
数据库工程师(计算机等级考试四级)
计算机等级考试三级
信息安全工程师(计算机等级考试四级)
嵌入式系统开发工程师(计算机等级考试四级)
软件测试工程师(计算机等级考试四级)
C++语言程序设计
Python语言程序设计
WPS Office高级应用与设计
C语言程序设计
C++语言程序设计
Java语言程序设计
Visual Basic语言程序设计
Web程序设计
Access数据库程序设计
MySQL数据库程序设计
Visual FoxPro数据库程序设计
办公软件高级应用
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。 (1)在类TestClass中定义name为字符串类型,age为整型,请在注释∥********1********之后添加语句。 (2)设置类TestClass0的基类为TestClass类的定义,请在注释∥********2********后添加语句。 (3)在类TestClass的派生类TestClass0的公有成员中定义析构函数TestClass0,请在∥********3********后添加。 (4)设置类TestClassl的基类为TestClass类的定义,请在∥********4********后实现。 本程序输出如下结果: TestClass class constructor TestClass0 class constructor TestClass on class constructor TcstClass l class constructor TestClass l class constructor TcstClass class constructor TestClass0 class constructor TestClass class constructor 注意:增加代码,或者修改代码的位置已经用符号表示出来。请不要修改其他的程序代码。 #include C1ass TestClass { ∥********1******** public: TestClass(){cout<<“TestClass class constructor”<
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹pmjl下的工程proj1,此工程中含有一个源程序文件proj1.cpp。其中位于每个注释“//ERROR****found****”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为:Thisobjectisno.1注意:只修改注释“//ERROR****found****”的下一行语句,不要改动程序中的其他内容。//proj1.cpp#include<iostream>usingnamespacestd;classMyClass{public:MyClass():count(0){cout<<"Thisobjectis";}//ERROR********found********voidInc()const{cout<<"no."<<++count<<end1;}private://ERROR********found********intcount=0;};intmain(){MyClass*obj=newMyClass;//ERROR********found*********obj.Inc();return0;}
进入题库练习
问答题使用VC6打开 下的源程序文件modi2.cpp。阅读下列函数说明和代码,完成空出部分程序。函数factor(int *des,int int n=20; factor(a,length, n); for (int i=0;i<length;i++) { cout a [i] ""; } cout endl; return; }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi l.cpp,该程序运行时有错误,请改正其中的错误,使程序正确运行。并且使程序输出的结果为: OK 注意:错误的语句在∥********error********的下面,修改该语句即可。 #include class CBase { public: CBase() { a=b=0; } private: int a,b, }; class CDerivel:public CBase { public: CDerivel() { } ∥********error******** virtual void func(), }; class CDerive2:publ ic CDerivel { public: CDerive2() { a=0; b=0; } void func() { ∥********error******** coutfunc(); }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,但该程序运行有问题,请改正main函数中的错误,使程序的输出结果是: nember=1 nember=10 nember=100 注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在//******error******的下面。#include<iostream.h>Class TestClass{public: TestClass(int i){ nember=i; } void SetNember(int m){ nember=m; } int GetNember()const{ return nember; } void Print()const{ cout<<"nember="<<nember<<end1; }private: int nember;};void main(){ //********error******** TestClass obj1; obj1.Print(); TestClass obj2(3); //********error******** obj 1.nember=10; //********error********TestClass.SetNember(100); obj1.Print(); obj2.Print();}
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。此程序的运行结果为: In CDerive's display().b=1 In CDerive2's display().b=2 其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。 (1)定义函数display()为无值型纯虚函数。请在注释//********1********之后添加适当的语句。 (2)建立类CDerive的构造函数,请在注释//********2********之后添加适当的语句。 (3)完成类CDerive2成员函数diaplay0的定义。请在注释//********3********之后添加适当的语句。 (4)定义类Derivel的对象指针d1,类CDerive2的对象指针d2。其初始化值分别为1和2。请在注释//********4********之后添加适当的语句。 注意:增加代码,或者修改代码的位置已经用符号表示出来。请不要修改其他的程序代码。#include<iostream>using namespace Std;Class CBase{public: CBaSe(int i){b=i;} //********1********protected: int b;};class CDerive:public CBase{public: //********2******** void display() { cout<<"In CDerive'sdisplay()."<<"b="<<b<<endl; }};class CDerive2:public CBase{public: CDerive2(int i):CBaSe(i){} //********3********};void func(CBase*obj){ obj->display();}Void main(){ //********4******** func(d1); func(d2);}
进入题库练习
问答题使用VC6打开下的源程序文件modi3.cpp。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。(1)完成默认构造函数TestClass的定义,使得TestClass对象的类型为int,默认值为a=0,b=0,c=0,请在注释//********1********后添加适当的语句。(2)定义类的私有成员变量,X、Y、Z类型为int,请在注释//********2********后添加适当的语句。(3)定义类TestClass的数据成员count声明为静态整数型数据成员,请在注释//********3********后添加适当的语句。(4)在构造函数中实现用count表示类TestClass被实现对象的次数。请在注释//********4********后添加适当的语句。本程序的输出结果为:Thepointis(1,1,1)Thereare3pointobjectsThepointis(1,2,3)Thereare3pointobjectsThepointis(0,0,0)Thereare3pointobjects注意:除在指定的位置添加语句之外,请不要改动程序的其他部分。#include<iostream>usingnamespacestd;classTestClass{public://********1********{X=a;Y=b;Z=c;//********4********}voidDisplay(){cout"Thepointis("X","Y","Z")"endl;cout"Thereare"count"pointobjects."endl;}private://********2********//********3********};intTestClass::count=0;intmain(){TestClassp1(i,i,i),p2(i,2,3),p3(0,0,0);p1.Display();p2.Display();p3.Display();return0;}
进入题库练习
问答题使用VC++6.0打开下的源程序文件1.cpp,该程序运行时有错误,请改正其中的错误,使得程序正确运行。 程序输出: s1:n=20 s2:n=10 执行s3.add(s1, s2) s3:n=30 s4:n=30 注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在//******error******的下面。 试题程序: #include<iostream.h> class TC { int n; public: TC(){} TC(int m) { n=m; } //********error******** TC add(TC s1, s2) { this->n=s1.n+s2.n; //********error******** return(this); } void disp() { cout<<"n="<<n<<endl; } //********error******** } void main() { TC s1(20), s2(10), s3, s4; cout<<"s1:"; s1.disp(); cout<<"s2:"; s2.disp(); s4=s3.add(s1, s2); cout<<"执行s3.add(s1, s2)/ns3:"; s3.disp(); cout<<"s4:"; s4.disp(); }
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2。该工程中包含一个程序文件main.cpp,其中有“书”类Book及其派生出的“教材”类TeachingMaterial的定义,还有主函数main的定义。请在程序中“//********found*******”下的横线处填写适当的代码,然后删除横线,以实现上述类定义和函数定义。此程序的正确输出结果应为: 教材名:C++语言程序设计 页 数:299 作 者:张三 相关课程:面向对象的程序设计 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#include<iostream>using namespace std;claSS Book{ //“书”类 char*title;//书名 int num_pages;//页数 char*writer; //作者姓名public: Book(const char*the title,int pages,const char*the—writer):num_pages(pages){ title=new char[strlen(the title)+1]; strcpy(title,the_title); //**********found********** strcpy(writer,the_writer); } //**********found********** 一Book(){________} int numOfPages()const{return num—paqes;) //返回书的页数 const char*theTitle()const{re-turn title;) //返回书名 const char*theWriter()const{re-turn writer;} //返回作者名},class TeachingMaterial:public Book{//“教材”类 char*course;public: TeachingMaterial(const char*the title,int pages,const char*the writer,const char*the course)//**********found********** :_____{ course=new char[strlen(the course)+1]; strcpy(course,the course); } —TeachingMaterial(){delete[]course;} const char*theCourse()const{re-turn course;) //返回相关课程的名称};int main(){TeachingMaterial a book(”C++语言程序设计”,299,“张三”,”面向对象的程序设计”); cout<<"教材名:"<<a book.theTitle()<<end1 <<”页数:”<<a—book.numOfPages()<<endl <<”作 者:”<<a book.theWriter()<<end1 //*********found*********<<”相关课程:”<<_________; cout<<end1; return 0;}
进入题库练习
问答题请使用VC6或使用【答题】菜单打开 proj2下的工程proj2,其中有整数栈类IntList、顺序栈类SeqList和链接栈类LinkList的定义。请在程序中的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为: 4 6 3 1 8 4 6 3 1 8 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动//“****found****”。 #include <iostream> using namespace std; class IntStack { //整数栈类 public: virtual void push(int) = 0; //入栈 virtual int pop() = 0; //出栈并返回出栈元素 virtual int topElement() const = 0; //返回栈顶元素,但不出栈 virtual bool isEmpty() const=0; //判断是否栈空 }; class SeqStack: public IntStack{int data[100]; //存放栈元素的数组 int top; //栈顶元素的小标 public: // ********found******** SeqStack():______{} //把top初始化为-1表示栈空 void push (int n) {data[++top] = n;} // **********found********** int pop() {return______;} int topElement() const {return data[top];} bool isEmpty() const {return top == -1;} }; struct Node{ int data; Node * next; }; class LinkStack: public IntStack{ Node * top; public: // **********found********** LinkStack():______{} //把top初始化为NULL表示栈空 void push (int n) { Node * p = new Node; p -> data = n; // **********found********** ______ top = p; } int pop(){ int d=top->data;; top=top->next; return d; } int topElement() const {return top -> data;} bool isEmpty() const {return top == NULL;} }; void pushData(IntStack st.push(1); st.push(3); st.push(6); st.push(4); } void popData(IntStack } int main(){ SeqStack st1; pushData(st1); popData(st1); cout << endl; LinkStack st2; pushData(st2); popData(st2); cout << endl; return 0; }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。阅读下列函数说明和代码,完成空出部分程序。函数convert(char*strOct)的功能是将八进制转换为十进制。 提示:要每一位转换,然后把转换后得到的数累加起来即可。 注意:不能修改其他部分的代码。 #include #include int convert(char*strOct) { } int main() { cout<
进入题库练习
问答题改错题 使用VC6打开考生文件夹下的工程test11_1,此工程包含一个源程序文件test11_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果如下: ch1=7 ch2=9 源程序文件test11_1.cpp清单如下: #include class Sample { /***************** found *****************/ char ch1,ch2 public: /***************** found *****************/ friend void set(Sample s, char c1,char c2) { s.ch1=c1; s.ch2=c2; } void print(){cout<<"ch1="<
问答题改错题 使用VC6打开考生文件夹下的工程test8_1,此工程包含一个源程序文件test8_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: f1 function of derive f2 function of base f4 function of base 源程序文件test8_1.cpp清单如下: #include class base { public: /**********found**********/ void f1(){ coutf1(); p->f2(); p->f4(); }
进入题库练习
问答题使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正程序中的错误,使得程序输出:   member:1   member:10   member:100   注意:错误的语句在/********error********/的下面,修改该语句即可。其他的语句不能修改。   试题程序:   #include   inti=100;   classTC   {   public:   TC(inti)   {   cout<<"member:"<  /********error********/   i=i+9:   }   voidPrint()const   {   cout<<"member:"<  }   private:   inti;   };   voidmain()   {   /********error********/   TCobj;   inti(0);   obj.Print();   /********error********/   cout<<"member:"<  return;   }
进入题库练习
问答题使用VC6打开考生文件夹下的工程test12_1,此工程包含一个源程序文件test_12.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果如下: fun (Sample &p) 1 2 fun (Sample *p) 3 4 20 10 源程序文件test12_1清单如下: #include<iostream .h> class Sample private: int x,y; static int z; public: Sample(int a,int b) x=a;y=b; void fun(Sample &p); void fun(Sample *p); static void print(Sample s); ; /*************** found ***************/ int z=10; void Sample::fun(Sample &p) x=p.x;y=p.y; cout<<"fun(Sample &p)"<<" "<<x<<" "<<y<<endl; void Sample::fun(Sample *p) /************** found **************/ x=p.x; y=p.y; cout<<"fun(Sample *p) "<<" '<<x<<" "<<y<<endl; void Sample::print (Sample s) /*************** found *****************/ x=20; cout<<s. x<<" "<<z<<endl; void main() Sample p(1,2),q(3,4); p. fun(p); p. fun(&q); p. print(p);
进入题库练习
问答题请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1。此工程中包含程序文件main.cpp,其中有类Door(“门”)和主函数main的定义。程序中位于每个“//ERROR ********found********”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: 打开503号门…门是锁着的,打不开。 打开503号门的锁…锁开了。 打开503号门…门打开了。 打开503号门…门是开着的,无须再开门。 锁上503号门…先关门…门锁上了。 注意:只修改每个“//ERROR ****found****”下的那一行,不要改动程序中的其他内容。 #include <iostream> using namespace std; class Door{ int num; //门号 boom closed; //true表示门关着 bool locked; //true表示门锁着 public: // ERROR ********* found********* Door (int n): num(n), closed (true), lock (true) { } bool isClosed () const { return closed; } //门关着时返回true,否则返回false bool isOpened () const { return ! closed; } //门开着时返回true ,否则返回false bool isLocked () const { return locked; } //门锁着时返回true,否则返回false boom isUnlocked () const { return ! locked; } //门未锁时返回true,否则返回false //ERROR ********* found********* void open()const{ //开门 cout << endl << "打开" << num << "号门..."; if(! closed) cout << "门是开着的,无须再开门。"; else if (locked) cout << "门是锁着的,打不开。"; else{ closed = false; cout << "门打开了。"; } } void close () { //关门 cout << endl <<"关上" << num <<"号门..."; if (closed) cout << "门是关着的,无须再关门。"; else{ closed=true; cout << "门关上了。"; } } void lock() { //锁门 cout << endl << "锁上" << num << "号门..."; if (locked) cout << "门是锁着的,无须再锁门。"; else{ // ERROR ********* found********* if (closed) { cout << "先关门..."; closed = true; } locked = true; cout << "门锁上了。"; } } void unlock () { //开锁 cour << endl << "打开" << num << "号门的锁..."; if(! locked) else{ locked = false; cout << "锁开了。"; } } }; int main () { Door door (503); door.open (); door.unlock (); door.open (); door.open (); door.lock (); return 0; }
进入题库练习
问答题使用VC6打开考生文件夹下的工程MyProj2。此工程包含一个源程序文件 MyMain2.cpp,此程序的运行结果为: Derive1's Print() Called. Derive2's Print() called. 其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。 ①定义函数Print()为无值型纯虚函数。请在注释“//**1**”之后添加适当的语句。 ②建立类Derivel的构造函数,请在注释“//**2**”之后添加适当的语句。 ③完成类Derive2成员函数Print()的定义。请在注释“//**3**”之后添加适当的语句。 ④定义类Derivel的对象指针d1,类Derive2的对象指针d2。其初始化值分别为1和2。 源程序文件MyMain2.cpp中的程序清单如下: //MyMain2. cpp #include <iostream> using namespace std; class Base public: Base(int i) b=i; //* * 1 * * protected: int b; ; class Derivel: public Base public: //* * 2 * * void print () cout<<" Derivel's Print() called."<<end1; ; class Derive2 : public Base public: Derive2(int i) :Base(i) //* * 3 * * ; void fun (Base *obj) obj->Print (); int main ( ) //* * 4 * * fun (d1); fun (d2); return 0;
进入题库练习
问答题请使用VC6或使用[答题]菜单打开考生文件夹proj2下的工程proj2。此工程中包含一个源程序文件main.cpp,其中有日期类Date、人员类Person及排序函数sortByAge和主函数main的定义。请在横线处填写适当的代码并删除横线,以实现该程序。该程序的正确输出结果应为: 排序前: 张三 男 出生日期:1978年4月20日 王五 女 出生日期:1965年8月3日 杨六 女 出生日期:1965年9月5日 李四 男 出生日期:1973年5月30日 排序后: 张三 男 出生日期:1978年4月20日 李四 男 出生日期:1973年5月30日 杨六 女 出生日期:1965年9月5日 王五 女 出生13期:1965年8月3日 注意:只在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。 #include <iostream> using namespace std; class Date{ //日期类 int year, month, day; //年、月、日 public: Date(int year, int month, int day): year (year), month (month), day (day) {} int getYear()const{ return year; } int getMonth () const { return month; } int getDay()const{ return day; } }; class Person{ //人员类 char name[14]; //姓名 bool is_male; //性别,为true时表示男性 Date birth date; //出生日期 public: Person (char * name, bool is_male,Date birth_date):is_male (is male),birth_date (birth_date) { //********** found********** strcpy (this -> name, ______); } const char * getName () const { return name; } bool isMale () const { return is_male; } Date getBirthdate () const { returnbirth_date; } int compareAge (const Person n = p. birth date. getYear () - birth_date.getYear (); if(n!=0) return n; //********** found********** ______ if(n!=0) return n; return p.birth date.getDay ()- birth_date .getDay (); } void show () { cout << endl; cout << name << " //显示姓名 //********** found********** << ______//显示性别(“男”或“女”,双引号内不含空格) <<"出生日期:" //显示出生日期 <<birth_date.getYear() <<"年" <<birth date.getMonth() <<"月" <<birth date.getDay() <<"日"; } }; void sortByAge(Person ps[], int size) { for (int i = 0; i < size -1; i++) {//采用挑选排序算法 int m=i; for (int j =i+1; j<size; j++) if (ps[j]. compareige (ps[m])<0) m=j; if (m>i) { //********** found********** Person p =______ ps[m] =ps[i]; ps[i] =p; } } } int main () { Person staff[] = { Person ("张三", true, Date (1978, 4, 20)), Person ("王五", false, Date (1965, 8, 3)), Person ("杨六", false, Date (1965, 9, 5)), Person ("李四", true, Date (1973, 5, 30)) }; const int size = sizeof (staff)/sizeof (staff[0]); int i; cout << endl << "排序前:"; for(i =0; i<size; i++) staff[i]. show (); sortByAge (staff, size); cout << endl << endl << "排序后:"; for(i=0; i<size; i++) staff[i]. show (); cout << endl; return 0; }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。阅读下列函数说明和代码,补充空出的代码。完成函数ToUpper(char*des,char*str),该函数实现把str字符串中小写字符转换成大写字符,并存发在des中。例如:str=“aBcdrFGHijK”;则:des=“ABCDEFGHIJK”;注意:不能修改程序的其他部分,只能补充ToUpper0函数。#include<iostream.h>#define MAXLEN1024void ToUpper(char*des,char*str){}void main(){char dest[MAXLEN];char*str="aBcdrFGHijK";ToUpper(dest,str);cout<<dest<<endl:return;}
进入题库练习
问答题使用VC++6.0打开下的源程序文件2.cpp。完成fun函数,使其功能为将两个按小到大排序的数组a和b,复制合并成一个有序整数序列c,其中形参n和m分别是数组a和b的元素个数。 注意:不能修改程序的其他部分,只能修改fun函数。 试题程序: #include<iostream.h> void fun(int a[], int n, int b[], int m, int*c) { } void main() { int A[]={3, 5, 7, 9, 11, 18, 21}; int B[]={6, 15, 19, 21, 39); int C[25], i; for(i=0; i<25; i++)C[i]=0; cout<<"A[]="; for(i=0; i<7; i++) cout<<A[i]<<','; cout<<endl; cout<<"B[]="; for(i=0; i<5; i++) cout<<B[i]<<','; cout<<endl; fun(A, 7, B, 5, C); cout<<"C[]="; for(i=0; i<12; i++) cout<<C[i]<<','; cout<<endl; return; }
进入题库练习