首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: Name:Smith Age:21 ID:99999 Cour
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: Name:Smith Age:21 ID:99999 Cour
admin
2015-06-27
24
问题
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:
Name:Smith
Age:21
ID:99999
CourseNum:12
Record:970
注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。
#include
usingnamespacestd;
clasSStudentInfo
{
protected:
//ERROR**********found**********
CharName;
intAge;
intID;
intCourseNum;
floatRecord;
public:
StudentInfo(char*name,intAge,
intID,intcourseNum,floatrecord);
//ERROR**********found**********
void~StudentInfo(){}
floatAverageRecord(){
returnRecord/CourseNum;
}
voidshow()const{
cout<<"Name:¨<
<
<<"CourseNum:"<
<”Record:"<
}
};
//ERROR**********found**********
StudentInfoStudentInfo(char*
Name,intAge,intID,intCourseNuml
floatRecord)
{
Name=name;
Age=age;
thiS->ID=ID;
CourseNum=courseNum;
Record=record;
}
intmain()
{
StudentInfost(”Smith”,21,99999,12,970);
st.show();
return0;
}
选项
答案
(1)char*Name; (2)~StudentInfo(){} (3)Studentlnfo::StudentInfo(char*nalne,intage,intID,intcourseNum,floatrecord)
解析
(1)主要考查考生对动态数组的掌握,由题目可知Name应该指向一个动态数组,而不是一个有效char型字符,因此要定义成char型指针。
(2)主要考查考生对析构函数的掌握,析构函数不需要函数返回类型,应把void去掉。
(3)主要考查考生对构造函数定义的掌握,构造函数也要使用作用域符号“::”。
转载请注明原文地址:https://kaotiyun.com/show/CDNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
定义重载函数时,应在参数个数或参数类型上【】。
输入流对象是输出流的源头,下面______不是输入流类。
通过______调用虚函数时,采用动态束定。
针对数组定义intdata[10];,下列表述中错误的是______。
算法的复杂度主要包括【】复杂度和空间复杂度。
在结构化方法中,用数据流程图(DFD)作为描述工具的软件开发阶段是()。
多数运算符既能作为类的成员函数重载,也能作为类的非成员函数重载,但口运算符只能作为类的【】函数重载。
若已定义的函数有返回值,则以下关于该函数调用的叙述中错误的是()。
在面向对象设计中,对象有很多基本特点,其中“一个系统中通常包含很多类,这些类之间呈树形结构”这一性质指的是对象的()。
在单项链表中删除一个指定结点的后继的时间复杂度为______。
随机试题
无环鸟苷(ACV)有效控制单纯疱疹病毒的作用机制是
下列各项中成立共同犯罪的情况有()
紧急电话系统根据传输介质可分为()。
【背景资料】某高速公路上下行分离式隧道,洞口间距40m,左线长3216m,右线长3100m,隧道最大埋深500m,进出口为浅埋段,Ⅳ级围岩,洞身地质条件复杂,地质报告指出,隧道穿越地层为三叠系底层,岩性主要为炭质泥岩、砂岩、泥岩砂岩互层,且有瓦斯
成本分析的方法包括()。
2014年8月中国公民赵某从A国取得特许权使用费收入折合人民币40000元,在A国缴纳了个人所得税8000元。赵某在我国应补缴的个人所得税为()万元。
下列销售预测分析方法中,属于定量分析法的是()。
在净利润和市盈率不变的情况下,公司实行股票分割导致的结果是()。
某有线电视供应商依靠其网络及现有成熟技术,向其用户提供宽带上网及电话服务,对当地电信企业造成较大冲击。则该有线电视供应商采用的策略是()。
小刘正在整理公司各产品线介绍的PowerPoint演示文稿,因幻灯片内容较多,不易于对各产品线演示内容进行管理。快速分类和管理幻灯片的最优操作方法是()
最新回复
(
0
)