多项选择题

请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程projl。程序中位于每个“//ERROR ****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:
Name:Smith Age:21 ID:99999 CourseNum: 12
Record:970
注意:只修改每个“//ERROR ****found****”下的那一行,不要改动程序中的其他内容。
#include <iostream>
using namespace std;
class Studentlnfo

protected:
//ERROR **********found**********
char Name;
int Age;
int ID;
int CourseNum;
float Record;
public:
Studentlnfo(char*name,int Age,int ID,int courseNum,float record);
//ERROR **********found**********
void ~Studentlnfo()
float AverageRecord()
return Record/CourseNum;

void show()const
cout<<"Name:"<<Name<<"Age:<<"CourseNum:"<<CourseNum<<"Record:"<<Record<<endl;

;
//ERROR **********found**********
Studentlnfo Studentlnfo (char*Name,int Age,int ID,int CourseNum,float Record)

Name=name;

Age=age;
this->ID=ID;
CourseNum=courseNum;
Record=record;int main()Studentlnfo st("Smith",21,99999,12,970);
st.show();
return 0;
热门 试题

问答题
请使用VC6或使用[答题]菜单打开考生文件夹proj2下的工程proj2,其中定义了vehicle类,并派生出motorcar类和bicycle类。然后以motorcar和bicycle作为基类,再派生出motorcycle类。要求将vehicle作为虚基类,避免二义性问题。请在程序中的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为: 80 150 100 1 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“ ****found****”。 #include <iostream.h> class vehicle private: int MaxSpeed; int Weight; public: **********found********** vehicle (int maxspeed,intweight):______ ~vehicle(); int getMaxSpeed()return MaxSpeed; int getWeight()return Weight; ; **********found********** class bicycle:______public vehicle private: int Height; public: bicycle(int maxspeed,int weight,int height):vehicle(maxspeed,weight),Height(height) int getHeight()return Height;; ; **********found********** class motorcar:______public vehicle private: int SeatNum; public: motorcar(int maxspeed,int weight,int seatnum):vehicle(maxspeed,weight),SeatNum(seatnum) int getSeatNum()return SeatNum;; ; **********found********** class motorcycle:______ public: motorcycle(int maxspeed,intweight,int height):vehicle (maxspeed,weight),bicycle(maxspeed,weight,height),motorcar(maxspeed,weight,1) ; void main () motorcycle a(80,150,100); cout<<a.getMaxSpeed()<<endl; cout<<a.getWeight()<<endl; cout<<a.getHeight()<<endl; cout<<a.getSeatNum()<<endl;