计算机类
公务员类
工程类
语言类
金融会计类
计算机类
医学类
研究生类
专业技术资格
职业技能资格
学历类
党建思政类
计算机等级考试(NCRE)
全国计算机应用水平考试(NIT)
计算机软件水平考试
计算机等级考试(NCRE)
全国高校计算机等级考试CCT
行业认证
信息素养
计算机等级考试二级
计算机等级考试一级
网络工程师(计算机等级考试四级)
计算机等级考试二级
数据库工程师(计算机等级考试四级)
计算机等级考试三级
信息安全工程师(计算机等级考试四级)
嵌入式系统开发工程师(计算机等级考试四级)
软件测试工程师(计算机等级考试四级)
C++语言程序设计
Python语言程序设计
WPS Office高级应用与设计
C语言程序设计
C++语言程序设计
Java语言程序设计
Visual Basic语言程序设计
Web程序设计
Access数据库程序设计
MySQL数据库程序设计
Visual FoxPro数据库程序设计
办公软件高级应用
问答题请使用VC6或使用[答题]菜单打开考生文件夹proj2下的工程proj2,该工程中包含一个程序文件main.cpp,其中有坐标点类point、线段类Line和三角形类Triangle的定义,还有main函数的定义。程序中两点间距离的计算是按公式实现的,三角形面积的计算是按公式实现的,其中。请在程序中的横线处填写适当的代码,然后删除横线,以实现上述类定义。此程序的正确输出结果应为:Side1:9.43398Side2:5Side3:8area:20注意:只在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#include<iostream>#include<cmath>usingnamespacestd;classPoint//坐标点类public:constdoublex,y;Point(doublex=0.0,doubley=0.0):x(x),y(y)//**********found**********doubledistanceTo(______)const//到指定点的距离returnsqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y));;classline//线段类public:constPointp1,p2;//线段的两个端点//**********found**********Line(Pointp1,Pointp2):______doublelength()constreturnp1.distanceTo(p2);//线段的长度;classTriangle//三角形类public:constPointpl,p2,p3;//三角形的三个顶点//**********found**********Triangle(______):p1(p1),p2(p2),p3(p3)doublelength1()const//边p1,p2的长度returnLine(p1,p2).length();doublelength2()const//边p2,p3的长度returnLine(p2,p3).length();doublelength3()const//边p3,p1的长度returnLine(p3,p1).length();doublearea()const//三角形面积//**********found**********doubleS=______;returnsqrt(s*(s-lengthl())*(s-length2())*(s-length3()));;intmain()Triangler(Point(0.0,8.0),Point(5.0,0.0),Point(0.0,0.0));cout<<"Side1:"<<r.length1()<<endl;cout<<"Side2:"<<r.length2()<<endl;cout<<"Side3:"<<r.length3()<<endl;cout<<"area:"<<r.area()<<endl;return0;
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。阅读下列函数说明和代码,完成空出部分程序。函数fun(hatN[4])的功能是用4个数字,组成互不相同且无重复数字的三位数,并将满足所有条件的数字输出到屏幕,并且每输出一个三位数字就换一行。 程序分析:可填在百位、十位、个位的数字都是1、2、3、0。组成所有的排列后再去掉不满足条件的排列。如果判定第一个数字是0则也去掉。 #include void fun(int N[4]) { } int main() { int N[4]={1,2,3,0}; fun(N); return 0 ; }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi1.cpp,该程序运行时有错误,请补充程序中的丢失部分,使得程序运行。可以在修改处增加或者删除一条语句。本程序完成以下功能:(1)获得输入的两个数字x1,x2(例如x1=4,x2=2);(2)输出两个中较小的一个(例如输出2);(3)计算x1/x2如果x2等于0,返回-1(输出结果2);(4)输出x1+x2的结果(输出结果6);(5)输出x1+1的结果(输出结果5);(6)输出x2-1的结果(输出结果1)。注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在//******error******的下面。#include<iostream.h>void main(){int x1;int x2;int x3;cout<<"pl ease input.two number:"(<endl;cin>>x1>>x2;//********error********x3=(x1>x2)?x1:x2;cout<<"Min number is:"<<x3<<endl;//计算x1/x2如果x2等于0,返回-1//********error********x3=(x2)?x1\x2:-1;cout;<<"x1/x2="<<x3<<endl;//********error********x3=(--x1)+(x2++);cout<<"x1+x2="<<x3<<endl;cout<<"x1+1="<<x1<<endl;cout<<"x2-1="<<x2<<endl;return;}
进入题库练习
问答题请使用VC6或使用[答题]菜单打开考生文件夹proj2下的工程proj2,其中定义了Component类、Composite类和Leaf类。Component是抽象基类,Composite和Leaf是Component的公有派生类。请在横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为: Leaf Node 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“// ****found****”。 #include<iostream> using namespace std; class Component public: //声明纯虚函数print() //**********found********** ; class Composite:public Component public: //**********found********** void setChild(______) m_child=child; virtual void print()const m_child->print(); private: Component*m_child; ; class Leaf:public Component public: virtual void print()const //**********found********** ______ ; int main() Leaf node; Composite comp; comp.setChild( Component*p= p->print(); return 0;
进入题库练习
问答题请使用【答题】菜单命令或直接用VC6打开考生文件夹下的工程prog3,其中声明了ValArray类,该类在内部维护一个动态分配的整型数组。ValArray类的复制构造函数应实现对象的深层复制。请编写ValArray类的复制构造函数。在main函数中给出了一组测试数据,此种情况下程序的输出应该是:ValArrayvl:{1,2,3,4,5}ValArrayv2={1,2,3,4,5}要求:补充编制的内容写在“//**********333**********”与“//**********666**********”之间,不得修改程序的其他部分。注意:程序最后将结果输出到文件out.dat中。输出函数writeToFile已经编译为boj文件,并且在本程序中调用。//VaiArray.h#include<iostream>usingnamespacestd;classVaiArray{int*v;intsize;public:VaiArray(constint*p,intn):size(n){v=newint[size];for(inti=0;i<size;i++)v[i]=P[i];}VaiArray(constVaiArray&other);~VaiArray(){delete[]v;}voidprint(ostream&out)const{out<<'{';for(inti=0;i<size-1;i++)out<<v[i]<<",";out<<v[size-1]<<'}';}voidsetArray(inti,intval){v[i]=val;}};voidwriteToFile(constchar*);//main.cpp#include"ValArray.h"ValArray::ValArray(constValArray&other){//********333********//********666********}intmain(){constinta[]={1,2,3,4,5);ValArrayv1(a,5);tout<<”ValArrayv1:”;v1.print(cout);cout<<end1;ValArrayv2(v1);cout<<"ValArrayv2=";v2.print(cout);cout<<end1;writeToFile("");return0;}
进入题库练习
问答题综合应用题 使用VC6打开考生文件夹下的工程test12_3,此工程包含一个test12_3.cpp,其中定义了类Base和类A,类A公有继承Base,但这两个类的定义都并不完整。请按要求完成下列操作,将程序补充完整。 (1)定义枚举类型变量en,它包含两个枚举符front和back,请在注释"// ** 1 ** "之后添加适当的语句。 (2)在类Base中添加常成员虚函数void E()的定义,该函数输出"In BaseE!",请在注释"// ** 2 ** "之后添加适当的语句。 (3)在类A中添加常成员虚函数void E()的定义,该函数先调用基类中的虚函数E()再输出"In AE!",请在注释"// ** 3 ** "之后添加适当的语句。 (4)完成类A构造函数的定义,请使用参数列表的形式初始化类A的成员,并输出"A constructor.",请在注释"// ** 4 ** "之后添加适当的语句。 输出结果如下: Base constructor. A constructor. In BaseE! In AE! In BaseP! In A! 1 A destructor. Base destructor. 注意:除在指定的位置添加语句外,请不要改动程序中的其他语句。 源程序文件test12_3.cpp清单如下: #include // ** 1 ** class Base { protected: int b1; int b2; public: Base(); ~Base(); int Getb1()const { return b1; } void Setb1(int x){ b1 = x; } int Getb2()const { return b2; } void Setb2(int y) { b2 = y; } void Print()const {cout<<"In BaseP!"<
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp,其中定义了用于表示学生学号的类CStudentlD,但类CStudentlD的定义并不完整。 运行结果为: 学生的学号为:200805 学生名为:李伟 删除学生学号为:200805 请按要求完成下列操作,将类CStudentlD的定义补充完成: (1)定义class CStudentlD类的私有数据成员IDvalue表示学生的学号,为long型的数据。请在注释∥********1********之后添加适当的语句。 (2)完成默认构造函数CStudentlD的定义,使CStudentlD对象的默认值为:id=0,并把学生的学号赋给IDvalue,并输出“赋给学生的学号:”及学号。请在注释∥********2********之后添加适当的语句。 (3)完成默认析构函数CStudentlD的定义,使CStudentlD析构时输出“删除学号:”及学号。请在注释∥********3********之后添加适当的语句。 (4)完成默认构造函数CStudentlnfo的定义。对应两个默认参数:要求定义char stName[],其默认值为“no name”,定义long stlD,其默认值设为0,并使它们赋值给相应的类数据成员。请在注释∥********4********之后添加适当的语句。 注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。 #include #include C1asS CStudentID { ∥********1********定义私有数据成员 public: ∥********2********定义默认构造函数 { IDvalue=id; cout<<“学生的学号为: ”<
进入题库练习
问答题请编写一个函数fun(char*num),该函数返回与传入的二进制数相应的十进制数,参数num指向存放8位二进制数的字符数组。二进制数转换为十进制数的方法是将二进制数的每一位乘以该位的权然后相加,如二进制数10010100=1*27+0*26 +0*25+1*24+0*23+1*22+0*21+2*0=148。 注意:部分源程序已存在文件test32_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数fun的花括号中填写若干语句。 文件test32_2.cpp的内容如下: #include<iostream.h> int fun(char *num) void main ( ) char num[8],ch; cout<<"Enter an 8 bit binary number"; for(int i=0;i<8;i++) cin>>ch; num[i]=ch; cout<<fun(num)<<end1;
进入题库练习
问答题使用VC6打开 下的源程序文件modi2.cpp。阅读下列函数说明和代码,完成空出部分程序,使该程序输出倒9×9口诀。 程序分析:分行与列考虑,共9行9列,设置两个变量i和j,i控制行,j控制列。 程序运行结果如下: 1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81 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=12 3*6=18 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=1 注意:只能补充函数show(),请勿改动其他部分的内容。 #include <iostream.h> void show () { } void main() { cout "9*9倒乘法口诀" endl; cout "------------------------------------------" endl; show(); cout "------------------------------------------" endl; return; }
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2,其中定义了vehicle类,并派生出motorcar类和bicycle类。然后以motorcar和bicycle作为基类,再派生出motorcycle类。要求将vehicle作为虚基类,避免二义性问题。请在程序中的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为:801501001注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#include<iostream.h>clasSvehicle{private:intMaxSpeed;intWeight;public://**********found**********vehicle(intmaxspeed,intweight):________一vehicle(){);intgetMaxSpeed(){returnMaxSpeed;}intgetWeight(){returnWeight;}},//**********found**********classbicycle:________publicvehicle{private:intHeight;public:bicycle(intmaxspeed,intweight,intheight):vehicle(maxspeed,weight),Height(height){}intgetHeight(){returnHeight;};},//**********found**********classmotorcar:________publicvehicle{private:intSeatNum;public:motorcar(intmaxspeed,intweight,intseatnum):vehicle(maxspeed,weight),SeatNum(seatnum){}intgetSeatNum(){returnSeatNum;};};//**********found**********classmotorcycle:________{public:motorcycle(intmaxspeed,intweight,intheight):vehicle(maxspeed,weight),bicycle(maxspeed,weight,height),motorcar(maxspeed,weight,1){}};voidmain(){motorcyclea(80,150,100);cout<<a.getMaxSpeed()<<end1;cout<<a.getWeight()<<end1;cout<<a.getHeight()<<end1;cout<<a.getSeatNum()<<end1;}
进入题库练习
问答题请使用VC6或使用【答题】菜单打开 proj1下的工程proj1,此工程中包含一个源程序文件main.cpp,其中有类Book(“书”)和主函数main的定义。程序中位于每个“// ERROR ****found****”下的语句行有错误,请加以改正。改正后程序的输出结果应该是: 书名:C++语句程序设计 总页数:299 已把“C++语言程序设计”翻到第50页 已把“C++语言程序设计”翻到第51页 已把“C++语言程序设计”翻到第52页 已把“C++语言程序设计”翻到第51页 已把书合上。 当前页:0 注意:只修改每个“// ERROR ****found****”下的那一行,不要改动程序中的其他内容。 #include <iostream> using namespace std; class Book{ char * title; int num_pages; //页数 int cur_page; //当前打开页面的页码,0表示书未打开 public: // ERROR *******found******* Book(const char * theTitle, int pages) num_pages(pages) { title = new char[strlen(theTitle) +1]; strcpy(title,theTitle); cout << endl << "书名" << title << "总页数:" << num_pages; } ~Book() {delete []title;} bool isClosed() const {return cur_page == 0;} //书合上时返回true,否则返回false bool isOpen() const {return! isClosed ();} //书打开时返回true,否则返回false int numOfPages() const {return num_pages;} //返回书的页数 int currentPage() const {return cur_page;} //返回打开页面的页码 // ERROR ********found******** void openAtPage(int page_no)const { //把书翻到指定页 cout << endl; if (page_no <1 || page_no >num_pages) { cout << "无法翻到第" << cur_page << "页。"; close (); } else { cur_page = page_no; cout << "已把“" << title << "”翻到第" << cur_page << "页"; } } void openAtPrevPage() {openAtPage(cur_page -1);} //把书翻到上一页 void openAtNextPage() {openAtPage(cur_page +1);} //把书翻到下一页 void close() { //把书合上 cout << endl; if (isClosed()) cout << "书是合上的。"; else{ // ERROR *******found******* num_pages = 0; cout << "已把书合上。"; } cout << endl; } }; int main(){ Book book("C++语言程序设计",299); book.openAtPage(50); book.openAtNextPage(); book.openAtNextPage(); book.openAtPrevPage(); book.close(); cout << "当前页:" << book.currentPage() << endl; return 0; }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。通过继承完成输入到屏幕指定的信息: TestClassA TestClassB TestClassC 其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。 (1)完成类B虚继承于A,请在注释//********1********后添加适当的语句。 (2)完成类C虚继承于A,请在注释//********2********后添加适当的语句。 (3)完成类D继承于B,C,请在注释//********3********后添加适当的语句。 (4)函数fun通过调用基类的fun,完成所输出的内容,请在注释//********4********后添加适当的语句。 注意:增加代码,或者修改代码的位置已经用符号表示出来。请不要修改其他的程序代码。 #include class TestClassA { public: void fun(){ cout<<"TestClassA"<
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp,其中定义了类baseA、priA1和priA2,其中priA1类由baseA类公有派生,priA2类由priA1类公有派生。上述三个类的定义并不完整,请按要求完成下列操作,将程序补充完整。 程序输出结果如下: 10 5 10 5 7 (1)定义类baseA的构造函数,该构造函数有一个整型的参数m,在构造函数中请将m赋值给数据成员a。请在注释“∥********1********”之后添加适当的语句。 (2)定义类priA1的构造函数,该构造函数有两个整型的参数m和n,在构造函数中请将m赋值给数据成员b,将n作为基类baseA构造函数的参数值传入。请在注释“∥********2********”之后添加适当的语句。 (3)定义类priA2的构造函数,该构造函数有三个整型的参数m,n和k,在构造函数中请将m赋值给数据成员c,将n和k分别赋值给基类priA1构造函数的参数m和n。请在注释“∥********3********”之后添加适当的语句。 (4)完成类priA2的成员函数show的定义,该函数调用基类成员函数,输出基类私有成员a和b及类priA2自身的数据成员c的值,上述三个值在输出时以空格隔开。请在注释“∥********4********”之后添加适当的语句。 注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。 #include C1ass baseA { int a; public: ∥********1******** int geta(){return a;) }; class priAl:public baseA { int b; public: ∥********2******** int getb(){return b;) }; class priA2:public priAl { int c; public: ∥********3******** void show() { ∥********4******** } }; void main() { priA2 a(7,5,i 0); cout<
进入题库练习
问答题使用VC6打开考生文件夹下的工程test26_3。此工程包含一个test26_3.cpp,其中定义了类queue,但该类的定义并不完整。请按要求完成下列操作,将程序补充完整。 (1)完成类queue的无参数的构造函数的定义,要求把数据成员bl和el都初始化为0,同时输出queue initialized。请在注释“//**1**”之后添加适当的语句。 (2)完成类queue的成员函数qput(int j)的定义,它的功能是把新的元素加入队列,过程是先依据bl的值判断数组是否已经满了,如果是就输出queue is full,否则bl自加一,并且把参数j的值存入bl指向的数组元素中,请在注释“//**2**”之后添加适当的语句。 (3)完成类queue的成员函数qget()的定义,它的功能是把队列开头的元素提取出队列,并返回该值,过程是先比较el和bl的值判断队列是否已空,如果是就输出queue is empty,否则el自加一,并且把el指向的数组元素返回,请在注释“// **3**”之后添加适当的语句。 程序输出结果如下: queue initialized queue initialized 33 11 44 22 注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。 源程序文件test26_3.cpp清单如下: #include<iostream.h> class queue int q[100]; int bl,el; public: queue( ); void qput(int j); int qget( ); ; queue::queue( ) // **1** void queue::qput(int j) // **2** cout<<"queue is full/n"; return; bl++; q[bl]=j; int queue::qget( ) // **3** cout<<"queue is empty/n"; return 0; el++; return q[el]; void main( ) queue aa,bb; aa.qput(11); bb.qput(22); aa.qput(33); bb.qput(44); cout<<aa.qget()<<" "<<aa.qget()<<"/n"; cout<<bb.qget()<<" "<<bb.qget()<<"/n";
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,但该程序运行时有错,请改正程序中的错误,使程序输出的结果为: 1 5 1注意:错误的语句在//*****error******的下面,修改该语句即可。#include<iostream.h>//*****error******enum{ Sun, Mon, Tue, Wed, Thu, Fri, Sat, //*****error******}MyEnum;Struct Struct{ //*****error****** int Fri, int Sun;};void main(){ int i=Mon; MyEnum t=Fri; Struct Str1; Str1.Fri=Mon; cout<<i<<end1; cout<<t<<end1; cout<<str1.Fri<<end1;}
进入题库练习
问答题请使用VC6或使用[答题]菜单打开考生文件夹proj3下的工程proj3,其中声明了SortedList类,是一个用于表示有序数据表的类。其成员函数insert的功能是将一个数据插入到一个有序表中,使得该数据表仍然保持有序。请编写这个insert函数。程序的正确输出应为: 插入前: 1,2,4,5,7,8,10 插入6和3后: 1,2,3,4,5,6,7,8,10 要求: 补充编制的内容写在“//********333********”与“//********666********”之间。不得修改程序的其他部分。 注意:程序最后将结果输出到文件out.dat中。输出函数writeToFile已经编译为obj文件,并且在本程序中调用。 //SortedList.h #include<iostream> using namespace std; class SortedList //有序数据表类 int len; double*d; public: SortedList(int len,double data[]=NULL); ~SortedList()delete[]d; int length()constreturn len;//有序数据表长度(即元素的个数) double getElement(int i)constreturn d[i]; void insert(double data); void show()const;//显示有序数据表 ; void writeToFile(char*,const Sort-edlist //main.cpp #include"SortedList.h" SortedList::SortedList (int len,double data[]):len(len) d=new double[len]; for(int k=0;k<len;k++) d[k]=(data==NULL?0.0:data[k]); for(int i=0;i<len-1;i++) int m=i; for(int j=i;j<len;j++) if(d[j]<d[m])m=j; double t=d[m]; d[m]=d[i]; d[i]=t; void SortedList::insert(double data) //********333******** //********666******** void SortedList::show()const //显示有序数据表 for(int i=0;i<len-1;i++) cout<<d[i]<<","; cout<<d[len-1]<<endl; int main () double s[]=5,8,1,2,10,4,7; SortedList list(7,s); cout<<"插入前:"<<endl; list.show(); list.insert(6.0 ); list.insert(3.0); list.show(); writeToFile(" ",list); return 0;
进入题库练习
问答题使用VC++6.0打开考生文件夹下的源程序文件2.cpp。完成函数fun(char *s,int a[]),其功能是把字符串s中的数字提取出来存储在a[]中,然后返回数字的个数。 例如s="1234abcdef567",则a[]中存储着1234567,返回7。 注意:不能修改程序的其他部分,只能修改fun函数。 试题程序: #include<iostream.h> int fun(char *s,int a[]) int main() int a[1024]; int len=fun("1234abcdef567",a); for(int i=0;i<len;i++) cout<<a[i]<<''; cout<<end1; cout<<i<<end1; return 0;
进入题库练习
问答题使用VC6打开 下的源程序文件modi2.cpp。阅读下列函数说明和代码,补充空出的代码。函数sum(int n)计算在n范围内,能被7和11整除的所有整数的和(包括n在内)。 注意:不能修改程序的其他部分,只能补充sum ()函数。 #include <iostream.h> double sum(int n) } } void main() { cout sum(80) endl; cout sum(200) endl; cout sum(300) endl; return; }
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2,该工程中包含一个程序文件main.cpp,其中有类CPolygon(“多边形”)、CRectangle(“矩形”)、CTfiangle(“三角形”)的定义。请在横线处填写适当的代码并删除横线,以实现上述类定义。该程序的正确输出结果应为: 20 10 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。#include<iostream>using namespace std;class CPolygon{public://*************found********** _______**纯虚函数area声明 void printarea(void) //**********found**********{cout<<______<<endl;}};class CRectangle:public CPolygon{ int width; //长方形宽 int height;//长方形高public: CRectangle(int W, int h):width(w),height(h){, int area(void){return(width*height);)},class CTriangle:public CPolygon{ int length; //三角形一边长 int height; //该边上的高public: CTriangle(int 1,int h):length(1),height(h){)//**********found********** int area(void){return()/2;)};int main(){ CRectangle rect(4,5); CTriangle trgl(4,5); //**********found**********_________*ppolyl,*ppoly2;ppoly1= return 0;}
进入题库练习
问答题请使用“答题”菜单或使用VC6打开考生文件夹proj2下的工程proj2,其中定义了vehicle类,并派生出motorcar类和bicycle类。然后以motocar和bicycle作为基类,再派生出motocycle类。要求将vehicle作为虚基类,避免二义性问题。请在程序中的横线处填写适当的代码,然后删除横线,以实现上述类定义。此程序的正确输出结果应为:801501001注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不能删除或移动“//**********found**********”。#include<iostream.h>classvehicle{private:intMaxSpeed;intWeight;public://**********found**********vehicle(intmaxspeed,intweight):________________~vehicle(){};intgetMaxSpeed(){returnMaxSpeed;}intgetWeight(){returnWeight;}};//**********found**********classbicycle:________publicvehicle{private:intHeight;public:bicycle(intmaxspeedlintweight,intheight):vehicle(maxspeed,weight),Height(height){}intgetHeight(){returnHeight;};};//**********found**********classmotorcar:________publicvehicle{private:intSeatNum;public:motorcar(intmaxspeed,intweight,intseatnum):vehicle(maxspeed,weight),SeatNum(seatnum){)intgetSeatNum(){returnSeatNum;};};//**********found**********classmotorCyCle:________{public:motorcycle(intmaxspeed,intweight,intheight):vehicle(maxspeed,weight),bicycle(maxspeed,weight,height),motorcar(maxspeed,weight,1){}};voidmain(){motorcyclea(8.0,150,100);cout<<a.getMaxSpeed()<<end1;cout<<a.getWeight()<<end1;cout<<a.getHeight()<<end1;cout<<a.getSeatNum()<<end1;}
进入题库练习