计算机类
公务员类
工程类
语言类
金融会计类
计算机类
医学类
研究生类
专业技术资格
职业技能资格
学历类
党建思政类
计算机等级考试(NCRE)
全国计算机应用水平考试(NIT)
计算机软件水平考试
计算机等级考试(NCRE)
全国高校计算机等级考试CCT
行业认证
信息素养
计算机等级考试二级
计算机等级考试一级
网络工程师(计算机等级考试四级)
计算机等级考试二级
数据库工程师(计算机等级考试四级)
计算机等级考试三级
信息安全工程师(计算机等级考试四级)
嵌入式系统开发工程师(计算机等级考试四级)
软件测试工程师(计算机等级考试四级)
C++语言程序设计
Python语言程序设计
WPS Office高级应用与设计
C语言程序设计
C++语言程序设计
Java语言程序设计
Visual Basic语言程序设计
Web程序设计
Access数据库程序设计
MySQL数据库程序设计
Visual FoxPro数据库程序设计
办公软件高级应用
进入题库练习
进入题库练习
请打开考生文件夹下的解决方案文件proj1,其中有枚举DOGCOLOR、狗类Dog和主函数main的定义。程序中位于每个“//ERROR ****found****”下的语句行有错误,请加以改正。改正后程序的输出结果应该是: There is a white dog named Hobo. There is a black dog named Haha. There is a motley dog named Hihi. 注意:只修改每个“//ERROR ****found****”下的那一行,不要改动程序中的其他内容。#includeiostreamusing namespace std;//狗的颜色:黑、白、黄、褐、花、其他enum DOGCOLOR {BLACK, WHITE,YELLOW,BROWN,PIEBALD,OTHER);class Dog {//狗类 DOGCOLOR color; char name[20]; static int count;public: Dog(char name[],DOGCOLORcolor){ strcpy(this-name,name);//ERROR ********found******** strcpy(this-color,color); } DOGCOLOR getColor()const{return colOr;}//ERROR ********found******** const char* get;Name()const{return*name;} const char * getColor-string()const{ switch(color){ case BLACK: return "black"; case WHITE: return "white"; case YELLOW: return "yellow"; case BROWN: ret;uEll "brown"; case PTEBALD: return "piebald"; } return"motley"; } void show()const{ cout"There is a"get-Colorstring() " dog named "name'.'endl; }};int main(){//ERROR ********found******** Dog dogl("Hoho",WHITE),dog2("Haha",BLACK);dog3("Hihi",OTHER); dog1.show(); dog2.show(); dog3.show(); return 0;}
进入题库练习
请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2。该工程中包含一个程序文件main.cpp,其中有“书”类Book及其派生出的“教材”类TeachingMaterial的定义,还有主函数main的定义。请在程序中“//*******found*******”下的横线处填写适当的代码,然后删除横线,以实现上述类定义和函数定义。此程序的正确输出结果应为: 教材名:C++语言程序设计 页 数:299 作 者:张三 相关课程:面向对象的程序设计 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#includeiostreamusing 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{returnnum_pages;}//返回书的页数 const char*theTitle()const{return title;)//返回书名 const char * theWriter()const{return 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{return course;} //返回相关课程的名称};int main(){ TeachingMaterial a_book("C++语言程序设计”,299,"张三",“面向对象的程序设计”); cout"教材名:"a book.theTitle()endl "页 数:"a book.numOf-Pages()endl "作 者:"a book.the-Writer()endl //***********found***********"相关课程:"_________; coutendl; return 0;}
进入题库练习
可以通过下面哪些函数实现类的多态性(  )。
进入题库练习
进入题库练习
进入题库练习
进入题库练习
进入题库练习
进入题库练习
请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2。此工程中包含一个源程序文件main.cpp,其中有“房间”类Room及其派生出的“办公室”类Office的定义,还有主函数main的定义。请在程序中“//****found****”下的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为: 办公室房间号:308 办公室长度:5.6 办公室宽度:4.8 办公室面积:26.88 办公室所属部门:会计科 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#inclUdeiostreamusing namespace std;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 room_no;}//返回房间号 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,double the_length,double the_width,const char *the depart)//**********found********** :___________{ depart=new char[strlen(the depart)+1];//**********found********** strcpy(________); } ~Office(){delete[]depart;} const char*theDepartment()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; return 0;}
进入题库练习
进入题库练习
进入题库练习
请打开考生文件夹下的解决方案文件proj2,此工程中包含一个程序文件main.cpp,其中有“班级”类Class和“学生”类Student的定义,还有主函数main的定义。在主函数中定义了两个“学生”对象,他们属于同一班级。程序展示,当该班级换教室后,这两个人的教室也同时得到改变。请在横线处填写适当的代码,然后删除横线,以实现上述类定义。此程序的正确输出结果应为: 改换教室前: 学号:0789 姓名:张三 班级:062113 教室:521 学号:0513 姓名:李四 班级:062113 教室:521 改换教室后: 学号:0789 姓名:张三 班级:062113 教室:311 学号:0513 姓名:李四 班级:062113 教室:311 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容。#includeiostreamusing namespace std;class class{ //“班级”类public: Class(conSt char*id,constchar*room){ strcpy(class id,id);//*******found******* } conSt char*getclassID()const { return class id;} //返回班号//*******found******* const char*getClassroom()const{__________} //返回所在教室房号 void changeRoomTo(const char*new room) { //改换到另一个指定房号的教室 strcpy(classroom,new room); }private: char class id[20]; //班号 char classroom[20]; //所在教室房号};class Student{ //“学生”类char my id[10];//学号char my name[20]; //姓名 Classmy class; //所在教室public://*******found******* Student(const char*the id,const char*the name,classthe class):_____________{ strcpy(my id,the id); strcpy(my_name,the_name); } const char*getID()const{return my_id;} const char*getName()const{return my_namej} Class getClass()const{return my class;}};void showStudent(Student *stu){ cout"学号:"stu-getID()" ";cout"姓名:"stu-getName()" "; cout"班级:"stu-get-class().getClassID()" "; cout"教室:"stu-get?class().getclassroom()endl;}int main(){ class cla("062113","521"); Student Zhang("0789","张三",cla),Li("0513","李四",cla); cout”改换教室前:"endl; showStudent(Zhang); showStudent(Li); //062113班的教室由521改换到311//*******found******* cout"改换教室后:"endl; showStudent(Zhang); showStudent(Li); return 0;}
进入题库练习
进入题库练习
进入题库练习
请打开考生文件夹下的解决方案文件proj2,该工程中包含一个程序文件main.cpp,其中有坐标点类point、线段类Line和三角形类Triangle的定义,还有main函数的定义。程序中两点间距离的计算是按公式d=实现的,三角形面积的计算是按公式f=实现的,其中s=请在程序中的横线处填写适当的代码,然后删除横线,以实现上述类定义。此程序的正确输出结果应为:Side1:9.43398Side2:5Side3:8area:20注意:只在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#include#includeusing namespace std;class Point{//坐标点类public:const double x,y;Point(double x=0.0,doubley=0.0):x(x),y(y){}//*******found*******double distanceTo(_______)const{//到指定点的距离return sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y));}};class Line{//线段类public:const Point p1,p2//线段的两个端点//*******found*******Line(Point p1,Pointp2):_______{}double length( )const{returnp1.distanceTo(p2);}//线段的长度};class Triangle{//三角形类public:const Point p1,p2,p3;//三角形的三个顶点//*******found*******Triangle(_______):p1(p1),p2(p2),p3(p3){}double lengthl( )const{//边p1,p2的长度return Line(p1,p2).length( );}double length2( )const{//边p2,p3的长度return Line(p2,p3).length( );}double length3( )const{//边p3,p1的长度return Line(p3,p1).length( );}double area( )const{//三角形面积//*******found*******double s=_______;return sqrt(s*(s-lengthl( ))*(s-length2( ))*(s-length3( )));}};int main( ){Triangle r(Point(0.0,8.0),Point(5.0,0.0),Point(0.0,0.0));coutcoutcoutcoutendl;return0;}
进入题库练习
进入题库练习
下列不是派生类对基类的继承方式的是(  )。
进入题库练习
进入题库练习