首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
请使用VC6或使用【答题】菜单打开考生文件夹pro1下的工程pmj1。程序中位于每个“//ERROR****found****”之后的一行语句=有错误,请加以改正。改正后程序的输出结果应该是: Name:SmithAge:21ID:99999CourseN
请使用VC6或使用【答题】菜单打开考生文件夹pro1下的工程pmj1。程序中位于每个“//ERROR****found****”之后的一行语句=有错误,请加以改正。改正后程序的输出结果应该是: Name:SmithAge:21ID:99999CourseN
admin
2015-06-27
32
问题
请使用VC6或使用【答题】菜单打开考生文件夹pro1下的工程pmj1。程序中位于每个“//ERROR****found****”之后的一行语句=有错误,请加以改正。改正后程序的输出结果应该是:
Name:SmithAge:21ID:99999CourseNum:12
Record:970
注意:只修改每个“//ERROR****found****”下的一行,不要改动程序中的其他内容。
#include
usingnamespacestd;
classStudentInfo
{
protected:
//ERROR**********found**********
charName[];
intAge;
intID;
intCourseNum;
floatRecord;
public:
//ERROR**********found**********
voidStudentInfo(char*name,intage,
intID,intcourseNum,floatrecord);
//ERROR**********found**********
void~StudentInfo(){delete[]
Name;}
floatAverageRecord(){
returnRecord/CourseNum;
}
voidshow()const;
};
StudentInfo::StudentInfo(char*name,intage,intID,intcourseNum,floatrecord)
{
Name=strdup(name);
Age=age;
thiS->ID=ID;
CourseNum=courseNum;
Record=record;
}
voidStudentInfo::show()const
{
cout<<"Name:"<
}
intmain()
{
StudentInfost(”Smith”,21,99.999,12,970);
st.show();
return0;
}
选项
答案
(1)char *Name; (2)StudentInfo(char *name, int age, int ID, int courseNum, float record); (3)~StudentInfo() { delete [] Name; }
解析
(1)根据构造函数的定义可知,Name应定义为指针变量。
(2)主要考查考生对构造函数定义的掌握,构造函数前不能添加任何类型。
(3)主要考查考生对析构函数定义的掌握,析构函数前不能添加任何类型。
转载请注明原文地址:https://jikaoti.com/ti/pkXiFFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
论述19世纪末20世纪初资本主义国家的发展趋势和特征。(江西师范大学2013年世界通史真题)
1915年在中国近代历史上看上去似乎没有特别重大的划时代的历史事件,但这一年发生的许多事件。既是此前各种矛盾发展的结果,又对此后的历史进程产生了重要影响。使这一年成为重要的历史关节点。请结合史事加以论述。(中山大学2015年历史学基础A真题)
学习程度对于遗忘有很大的影响,为了达到最好的学习结果,学习程度应达到多少
如果两变量之间存在正相关,且所有相关点都落在回归线上,则这两个变量之间的相关系数是()
提出人类具有三种灵魂即植物灵魂、动物灵魂和人的灵魂并分别以不同教育方式予以教育培养的思想家是
属于同一行业、规模相同且利润率相同的公司的股票一般对市场指数的反应程度相同。()
实体法与程序法的划分标准是()。
以下选项中不属于我国法律制定程序的是()
设f(x)是满足=1的连续函数,则当x→0时是关于x的________阶无穷小量.
设函数f(x)在点x=1的某邻域内有定义,且满足3x≤f(x)≤x2+x+1,则曲线y=f(x)在点x=1处的切线方程为________.
随机试题
关于肾血液循环特点的描述,错误的是
急性溶血性贫血时多见的是慢性溶血性贫血时多见的是
血糖是指血液中的
诊断早期糖尿病肾病较有意义的检查是
根据《房产测量规范》,下列项目中,计算一半建筑面积的是()。
目前我国剪力墙和简体体系的高层建筑施工用得最多的一种模板是(),已形成一种工业化建筑体系。
2013年10月15日,人民法院根据债权人申请受理了A公司破产清算案,并指定了管理人。在该破产案件中,存在以下情况:(1)根据A公司章程的规定,股东分两期缴纳出资,其中,第一期出资于2011年2月1日公司设立时缴纳,第二期出资于20141年2月28日前缴
对于经常出差的人员来说,使用平板电脑能够给他们带来方便,平板电脑是易操作的办公设备,可以视为一个好的设备。但是平板电脑更新换代太过频繁,会加入许多新的软件,所以,它可能并不能被视为一个好的设备。以上推断基于的假设是()。
VBA中,将字符代码转换为对应字母的函数是
在标准ASCII码表中,已知英文字母D的ASCII码是01000100,英文字母A的ASCII码是()。
最新回复
(
0
)