题目内容

请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1,此工程中含有一个源程序文件proj1.cpp。其中位于每个注释“//ERROR****found****”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为:Thevalueis:10注意:只修改注释“//ERROR****found****”的下一行语句,不要改动程序中的其他内容。//proj1.cpp#include<iostream>USingnamespacestd;classMember{//ERROR********found********private:Member(intval):value(val){}intvalue;};classMyClass{Memberm;public://ERROR********found********MyClass(intval)()intGetValue()const{returnm.value;)};intmain(){MyClass*obj=newMyClass(io);//ERROR********found********下列语句输出obj指向类中的value值cout<<"Thevalueis:"<<obj.GetValue()<<end1;deleteobj;return0;}

查看答案
更多问题

请使用“答题”菜单或使用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;}

有如下类和对象的定义: class Constants {public:static double getPI() { return 3.1416; }};Constants constants;下列各组语句中,能输出3.1416的是( )。

A. cout B. cout<

下列关于函数模板的表述中,正确的是

A. 函数模板是一个实例函数
B. 使用函数模板定义的函数没有返回类型
C. 函数模板的虚拟类型参数就是函数参数
D. 通过使用不同的类型参数,可以从函数模板得到不同的实例函数

长效的糖皮质激素

A. 泼尼松
B. 氢化可的松
C. 地塞米松
D. 倍他米松
E. 氟氢可的松

答案查题题库