填空题
使用VC6打开考生文件夹下的工程test21_1,此工程包含一个源程序文件test21_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:
The grade is 3
源程序文件test21_1.cpp清单如下:
#include<iostream.h>
class student
{
private:
int grade;
public:
/**************** found*******************/
student(int thegra):(thegra){}
~student(){}
int get_grade(){return grade;}
};
void main()
{
int thegra=3;
/**************** found*******************/
student point=new student(thegra);
/**************** found*******************/
cout<<"The grade is"<<point.get_grade()<<endl;
delete point;
}
【参考答案】
(1)错误:student(int thegra):(thegra){} 正确:student(int thegra):......
(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)