计算机类
公务员类
工程类
语言类
金融会计类
计算机类
医学类
研究生类
专业技术资格
职业技能资格
学历类
党建思政类
计算机等级考试(NCRE)
全国计算机应用水平考试(NIT)
计算机软件水平考试
计算机等级考试(NCRE)
全国高校计算机等级考试CCT
行业认证
信息素养
计算机等级考试二级
计算机等级考试一级
网络工程师(计算机等级考试四级)
计算机等级考试二级
数据库工程师(计算机等级考试四级)
计算机等级考试三级
信息安全工程师(计算机等级考试四级)
嵌入式系统开发工程师(计算机等级考试四级)
软件测试工程师(计算机等级考试四级)
C++语言程序设计
Python语言程序设计
WPS Office高级应用与设计
C语言程序设计
C++语言程序设计
Java语言程序设计
Visual Basic语言程序设计
Web程序设计
Access数据库程序设计
MySQL数据库程序设计
Visual FoxPro数据库程序设计
办公软件高级应用
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。阅读下列函数说明和代码,完成空出部分程序。函数fun(char*s,char*s1,char*s2)中形参字符串s1和s2有相同的字符个数,且s1中各字符互不相同。该函数实现将已知字符串S中所有在字符串s1中也存在的字符,都用字符串s2中的对应位置的字符代替。 例如:设字符串S、sl和s2分别为: S[]="ABCABC", s1[]="AC", s2[]="ZX" 则s2中的字符Z和X分别对应s1中的字符C和A,函数调用fun(s,s1,s2)将字符串S的内容变为"ZBXZBX"。 注意:不能修改程序的其他部分,只能修改fun()函数。 #include void fun(char*s,char*s1,char *s2) { } Void main() { char s[]="ABCABC"; fun(s,"AC","ZX"); std::cout<
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生目录proj3下的工程文件proj3,此工程中包含一个源程序文件proj3.cpp,补充编制C++程序proj3.cpp,其功能是读取文本文件in.dat中的全部内容,将文本存放到doc类的对象myD0c中。然后将myDoc中的字符序列反转,并输出到文件out.dat中。文件in.dat的长度不大于1000字节。 要求: 补充编制的内容写在“//**************333*************”与“//*************66666***********”两行之间。实现将myDoc中的字符序列反转,并将反转后的序列在屏幕上输出。不得修改程序的其他部分。 注意:程序最后已将结果输出到文件out.dat中,输出函数writeToFile已经给出并且调用。//proj 3,cpp#include<iostream>#include<fstream>#include<cstring>using namespace std;class doc{private: char/str;//文本字符串首地址 int length;//文本字符个数public://构造函数,读取文件内容,用于初始化新对象,filename是文件名字符串首地址 doc(char*filename); void reverse();//将字符序列反转 一doc(); void writeToFile(char*filename);};doc::doc(char*filename){ ifstream myFile(filename); int len=001,tmp; str=new char[fen]; length=0; while((tmp=myFile.get())!=EOF) { str[length++]=tmp; } str[length]=’\0’; myFile.close(); } void doc::reverse(){ //将数组str中的length个字符中的第一个字符与最后一个字符交换,第二个字符与倒数第二个 //字符交换…… //**********333********** //**********666********** } doc::一doc() { delete[]str; } void doc::writeToFile (char * filename) { ofstream outFile(filename); outFile<<str; outFile.close(); } void main() { doc myDoc(”in.dat”); myDoc.reverse(); myDoc.writeToFile(”out.dat”); }
进入题库练习
问答题使用VC6打开 下的源程序文件modi1.cpp,但该程序运行时有错,请改正程序中的错误,使程序输出的结果为: 150 200 注意:错误的语句在//******error******的下面,修改该语句即可。 提示:定义Number1为一个整型数据位长的变量。 #include<iostream.h> //******error****** struct { //******error****** int Number1: 1; int Number2; } MyStruct; void main() { MyStruct mstr; mstr.Number1=150; mstr.Number2=15; //******error****** int* ptr= cout *ptr endl; *ptr=200; cout *ptr endl; }
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2。此工程中包含一个源程序文件main.cpp,其中有“房间”类Room及其派生出的“办公室”类Office的定义,还有主函数main的定义。请在程序中“//****found****”下的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为:办公室房间号:308办公室长度:5.6办公室宽度:4.8办公室面积:26.88办公室所属部门:会计科注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#jnclude<iostream>using namespacestd;class Room{//“房间”类int room_no;//房间号double length;//房间长度(m)double width;//房间宽度(m)public:Room(int the_room_no,double the_length,double the_width):room_no(the_room_no),length(the_length),width(the_width){}int theRoomNo()const{return roomn_o;}//返回房间号double theLength()const{return length;}//返回房间长度double theWidth()const{return width;}//返回房间宽度//**********found**********double theArea()const{______________}//返回房间面积(矩形面积)};class Office:public Room{//“办公室”类char*depart;//所属部门public:Office(int the_room_no,doublethe_length,double the_width,const char*the_depart)//**********found**********:______________{depart=new char[strlen(the_depart)+1];//**********found**********strcpy(______________);}~Office(){delete[]depart;}const char,IctheDepartment()const{return depart;}//返回所属部门};int main(){//**********found**********Office______________;cout<<"办公室房间号:"<<an_office.theRoomNo()<<endl<<"办公室长度:"<<an_office.theLength()<<endl<<"办公室宽度:"<<an_office.theWidth()<<endl<<"办公室面积:"<<an_office.theArea()<<endl<<"办公室所属部门:"<<an_office.theDepartment()<<endl;return0;}
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,但该程序运行时有错,请改正程序中的错误,使程序输出的结果为: 150 200 注意:错误的语句在∥********error********的下面, 修改该语句即可。 提示:定义Number1为一个整型数据位长的变量。 #include ∥********error******** Struct { ∥********error******** int Number1:1; int Number2; }MyStruct; void main() { MyStruct mstr; mstr.Number1=150; mstr.Number2=15; ∥********error******** int*ptr=&mstr.Number1; cout<<*ptr<
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。阅读下列函数说明和代码,完成空出部分程序,使该程序输出倒9×9口诀。 程序分析:分行与列考虑,共9行9列,设置两个变量i和j,i控制行,j控制列。 程序运行结果如下: 1-9=9 2*9=1 8 3*9=27 4*9=36 5*9=45 6*9=54 7*9= 63 8*9=72 9*9=8 1 1*8=8 2.8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8= 56 8*8=64 1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7= 42 7*7=49 1*6 6 2*6=1 2 3*6=1 8 4*6=24 5*6=30 6*6=36 1*5=5 2*5=10 3*5=15 4*5=20 5*5=25 1*4=4 2*4=8 3*4=12 4*4=16 1*3=3 2*3=6 3*3=9 1*2=2 2*2=4 1*1=l 注意:只能补充函数show(),请勿改动其他部分的内容。 #include void show() { } void main() { cout<<”9*9倒乘法口诀I-<
进入题库练习
问答题请使用VC6或使用【答题】菜单打开 proj1下的工程proj1,其中在编辑窗口内显示的主程序文件中定义有类ABC和主函数main。程序文本中位于每行“// ERROR ****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应该是: 21 23 注意:只修改每个“// ERROR ****found****”下面的一行,不要改动程序中的其他任何内容。 #include <iostream> using namespace std; class ABC { public: // ERROR *******found******* ABC() {a=0; b=0; c=0;} ABC(int aa, int bb, int cc); void Setab() {++a, ++b;} int Sum() {return a+b+c;} private: int a,b; const int c; }; ABC::ABC (int aa, int bb, int cc):c(cc) {a=aa; b=bb;} int main() { ABC x(1,2,3), y(4,5,6); ABC z, *w= w->Setab(); // ERROR *******found******* int s1 =x.Sum() + y -> Sum(); cout << s1 << ""; // ERROR *******found******* int s2 = s1 + w.Sum(); cout << s2 << endl; return 0; }
进入题库练习
问答题使用VC++6.0打开考生文件夹下的源程序文件2.cpp。阅读下列函数说明和代码,补充空出的代码。函数DecToBin(char *des,int n)的功能是将十进制数据n转换成二进制数据,并将转换结果存放在des中。 例如:58的二进制数据为111010,则 DecToBin(char *des,58); cout<<des<<end1; 输出结果为:111010 注意:不能修改程序的其他部分,只能补充DecToBin(char*des,int n)函数。 试题程序: #include<iostream.h> #define MAXLEN 1024 void DecToBin(char *des,int n) void main() char des[MAXLEN]; int n=58; DecToBin(des,n); cout<<des<<end1; return;
进入题库练习
问答题使用VC6打开下的源程序文件modi.cpp,该程序运行时有错误,请改正错误,使得程序正常运行,并且要求最后一个catch()必须抛出执行的任何异常。程序通过抛出异常输出:error0ERROR注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在//********error********的下面。#include<iostream.h>intmain(){try{throw("error");}//********error********catch(chars){coutsendl;}try{throw((int)0);}//********error********catch(){coutiendl;}try{throw(0);throw("error");}//********error********catch(){cout}return0;}
进入题库练习
问答题使用VC6打开下的源程序文件modi.cpp,该程序运行时有错,请改正其中错误,使得程序正常运行,并使程序输出的结果为:cTbst注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在//********error********的下面。#include<iostream.h>voidmain(){//********error********charc="c";coutcendl;//********error********charb=1024;//********error********b+=1024;if(b==2048){cout"Test"endl;}return;}
进入题库练习
问答题b. display();
进入题库练习
问答题请使用VC6或使用【答题】菜单打开 proj3下的工程文件proj3,此工程中包含一个源程序文件proj3.cpp,其功能是从文本文件in.dat中读取全部整数,将整数序列存放到intArray类的对象中,然后建立另一对象myArray,将对象内容赋值给myArray。类intArray重载了“=”运算符。程序中给出了一个测试数据文件input,不超过300个的整数。程序的输出是: 10 11 13 16 20 要求: 补充编制的内容写在“// ********333********”与“// ********666********”之间。实现重载赋值运算符函数,并将赋值结果在屏幕输出。格式不限。不得修改程序的其他部分。 注意:程序最后将结果输出到文件out.dat中。输出函数writeToFile已经编译为obj文件,并且在本程序中调用。 //intArray.h class intArray { private: int * array; int length; public: intArray(char * filename); intArray(); intArray ~intArray(); void show(); }; void writeToFile(const char * path); //main.cpp #include <iostream> #include <fstream> #include <cstring> #include "intArray.h" using namespace std; intArray::intArray() { length = 10; array = new int[length]; } intArray::intArray (char * filename) { ifstream myFile(filename); array = new int[300]; length = 0; while(myFile >> array[length ++]) length --; myFile.close(); } intArray length = src.length; array = new int[length]; // *************333*********** // *************666*********** return * this; } intArray::~intArray() { delete [] array; } void intArray::show() { int step=0; for(int i=0; i<length; i=i+step) { cout <<array[i] <<endl; step ++; } } void main() { intArray * arrayP = new intArray ("input.dat"); intArray myArray; myArray = * arrayP; (* arrayP).show(); delete arrayP; writeToFile(" "); }
进入题库练习
问答题简单应用题 编写一个函数intcharnum(charfn[10]),该函数以只读方式打开文件fn,,通过统计,返回文件中字符的个数,请使用while循环实现计数功能。 注意:部分源程序已存在文件kt7_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数charnum的花括号中填写若干语句。 文件kt7_2.cpp的内容如下: #include #include #include intcharnum(charfn[10]); voidmain() {intnum; num=charnum("abc.txt"); cout intcharnum(charfn[10]) { }
进入题库练习
问答题请编写一个函数int SeqSearch(int list[],int start,int n,int key),该函数从start开始,在大小为n的数细list中查找key值,返回最先找到的key值的位置,如果没有找到则返回-1。请使用for循环实现。 注意:部分源程序已存在文件test19_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数SeqSearch的花括号中填写若干语句。 文件test19_2.cpp的内容如下: #include <iostream.h> int SeqSearch(int list[], int start, int n, int key) void main() int A[10]; int key, count=0, pos; cout<<"Enter a list of 10 integers: "; for(pos=0;pos<10;pos++) cin>>A[pos]; cout<<"Enter a key: "; cin>>key; pos=0; while( (pos=SeqSearch(A, pos,10,key))!=-1) count++; pos++; cout<<key<<" occurs "<<count<<(count!=1?" times":" time")<<" in the list."<<end1;
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹prog2下的工程prog2。此工程中包含一个程序文件main.cpp,其中有“部门”类Department和“职工”类Staff的定义,还有主函数main的定义。在主函数中定义了两个“职工”对象,他们属于同一部门。程序展示,当该部门改换办公室后,这两个人的办公室也同时得到改变。请在程序中的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为:改换办公室前:职工号:0789 姓 名:张三 部 门:人事处 办公室:521职工号:0513 姓 名:李四 部 门:人事处 办公室:521改换办公室后:职工号:0789 姓 名:张三 部 门:人事处 办公室:311职工号:0513 姓 名:李四 部 门:人事处 办公室:311注意:只在横线处填写适当的代码,不要改动程序中的其他内容。#include<iostream>using namespace std;class Department{ //“部门”类public:Department (const char * name,const char*office){strcpy(this一>name,name);//**********found***********}const char*getName()const{return name;) //返回部门名称//**********found*********** const char*getOffice()const{_______) //返回办公室房号 void changeOfficeT0(const char*office){ //改换为指定房号的另一个办公室strcpy(this一>office,office);}private: char name[2 0]; //部门名称 char office[20];//部门所在办公室房号};class Staff{ //“职工”类public://**********found*********** Staff(const char*my—id,constchar*my—name,Department&mydept):__________{strcpy(this一>staff_id,my id);strcpy(this一>name,my_name);}const char*getID()const{returnstaff id;) const char*getName()const{return name;}Department getDepartment()const{return dept;}private: char staff id[10]; //职工号 char name[20]; //姓名 Department&dept; //所柱部门};void showStaff(Staff&staff){cout<<“职工号:”<<staff.getID()<<“”;cout<<“姓名:”<<staff.getName()<<“”;cout<<“部门:”<<staff.getDepart.ment().getName()<<“”; cout<<“办公室:”<<staff.getDepart.ment().getOffice()<<endl;}int main(){ Department dept(“人事处”,521”); Staff Zhang(”07 89”,”张三”,dept),Li(”0513”,”李四”,dept); cout<<”改换办公室前:t<<endl; showStaff(Zhang); showStaff(Li); //人事处办公室由521搬到311 //********** found*********** cout<<“改换办公室后:”<<endl; showStaff(Zhang); showStaff(Li); return 0; }
进入题库练习
问答题试题源程序文件清单如下://number.cpp#include"Number.h"#include<iostream>#include<iomanip>#include<strstream>usingnamespacestd;charNumber::buf[33]="";constchar*HexNumber::toString()conststrstreamstr(buf,33);str<<hex<<uppercase<<showbase<<n<<ends;returnbuf;constchar*OctNumber::toString()conststrstreamstr(buf,33);str<<oct<<showbase<<n<<ends;returnhuf;constchar*DecNumber::toString()conststrstreamstr(buf,33);str<<dec<<n<<ends;returnbuf;//proj2.cpp#include"Number.h"#include<iostream>usingnamespacestd;voidshow(Number//按既定的数制显示输出参数对象number的值intmain()show(OctNumber(11));coutshow(DecNumber(11));cout//**********found**********________________________;//以十六进制格式输出十进制数11cout<<endl;return0:
进入题库练习
问答题使用VC6打开 下的源程序文件modi3.cpp。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。完成以下功能: (1)定义类的私有变量a、b,请在注释//********1********后添加适当的语句。 (2)完成类的构造函数,对变量a、b赋值,缺省两个变量值为1,在注释//********2********之后添加语句。 (3)完成打印函数display(),打印出“a*b=c”格式的一个乘法算式,在注释//********3********之后添加语句。 (4)补充主函数,使得打印9×9的乘法口诀。在注释//********4********后添加语句。 注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。 #include<iostream.h> class CMyFormula { private: //********1******** public: //********2******** { this->a=a; this->b=b; } void set(int x, int y) { a=x; b=y; } void display() { //********3******** } }; int main() { CMyFormula formular(1,1); for(int i=1;i<=9;i++) { //********4******** for (int j=1; j++) { formular, set (j, i); formular.display(); cout " "; } cout endl; } return 0; {
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl,该工程中包含程序文件main.epp,其中有类Door(“门”)和主函数main的定义。程序中位于每个“//ERROR****found ****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: 打开503号门…门是锁着的,打不开。 打开503号门的锁…锁开了。 打开503号门…门打开了。 打开503号门…门是开着的,无须再开门。 锁上503号门…先关门...门锁上了。 注意:只修改每个“//ERROR***********found **********”下的那一行,不要改动程序中的其他内容。 #include using namespace std; class Door{ int Bum;//门号 bool closed;//true表示门关着 bool locked://true表示门锁着 public: Door(int nHm){ //ERROR***********found*********** nun=this一>ann: closed=locked=true: } bool isClosed()const{rehlrn closed;} //门关着时返回true,否则返回false bool isOpened()const{return!closed;} //门开着时返回true,否则返回false b001 isLocked()const{retum locked;} //门锁着时返回true,否则返回false bool isUnlocked()const{return!locked;} //门未锁时返回true,否则返回false void open(){ //开门 cout<
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错误,请改正其中的错误,使程序正常运行,并且输出以下结果: (4,5) 7,8 (4,8) 注意:错误的语句在 ∥********error********的下面,修改该语句即可。 #include class cobj0 { public: cobj 0(int i,int j) { x=i; y=j; } ∥********error******** virtual void m0Ve(int a;int b) { x+=a; y+=b; } void print() { cout<<“(”<
进入题库练习
问答题基本操作 请使用"答题"菜单或使用VC6打开考生文件夹下的工程proj1。此工程包含程序文件main.cpp。程序中位于每个// ERROR **********found**********下的语句行有错误,请加以更正。更正后程序的输出应该是: 1958年3月23日比2001年11月5日更早 2001年11月5日比1958年3月23日更晚 2001年11月5日与2001年11月5日是同一日期 注意:只能修改每个// ERROR **********found**********下的那一行,不要改动程序中的其他内容。
进入题库练习