题目内容:
请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程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 coumeNum,float record);
//ERROR ********************found********************
void~Studentlnfo(){}
float AverageRecord(){
return Record/CourseNum;
}
void show()const{
cout<<”Name:”<<Name<<”Age:”<<Age<<”ID:”<<ID
<<”CourseNum:”<<CourseNum<<”Record:”<<Record<<endl;
}
};
//ERROR ******************found**************
StudentInfo StudentInfo(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;
}
参考答案:
答案解析: