首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:Name:Smith Age:21 ID:99999
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:Name:Smith Age:21 ID:99999
admin
2020-06-29
25
问题
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:Name:Smith Age:21 ID:99999 Coure-Num:12 Record:970
注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。
#include
using namespace std;
class StudentInfo
{
protected:
//ERROR ********found********
char Name;
int Age;
int ID;
int CourseNum;
float Record;
public:
StudentInfo(char*name,intAge , int IDf int courseNum ,float record);
//ERROR********found********
void~StudentInfo(){)
float AVerageRecord(){
return Record/CourseNum;
}
void show()const{
cout<<"Name:"<
<<"CourseNum:"<
}
};
//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()
{
StudentInfo st("Smith",21,99999,12,970);
st.show();
return 0 ;
}
选项
答案
(1)char*Name: (2)~StudentInfo(){} (3)StudentInfo::StudentInfo(char*name,int age,int ID,int courseNum,float record)
解析
(1)主要考查考生对动态数组的掌握,由题目可知Name应该指向一个动态数组,而不是一个有效char型字符,因此要定义成char型指针。
(2)主要考查考生对析构函数的掌握,析构函数不需要函数返回类型,应把void去掉。
(3)主要考查考生对构造函数定义的掌握,构造函数也要使用作用域符号“::”。
转载请注明原文地址:https://kaotiyun.com/show/Pzyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是( )。
请使用VC6或使用【答题】菜单打开考生文件夹pmjl下的工程pmjl。此工程定义了StopWatch(秒表)类,用于表示时、分、秒信息,有构造函数StopWatch()、设置时间函数reset(),并且重载了前置和后置++运算符,实现增加1秒的功能。程序
下列语句中,错误的是()。
请使用VC6或使用【答题】菜单打开考生文件夹pmj2下的工程pmj2,其中有矩阵基类MatrixBase、矩阵类Matrix和单位阵UnitMatrix的定义,还有main函数的定义。请在横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1,此工程中含有一个源程序文件proj1.cpp。其中位于每个注释“//ERROR****found****”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为:Constru
下面是重载为非成员函数的运算符函数原型,其中错误的是
使用VC6打开考生文件夹下的源程序文件modi2.cpp。阅读下列函数说明和代码。函数num(char*str)实现返回字符串中非数字的个数。例如:abcl23abc45返回输出:6将函数num()补充完整。注意:请勿改动主函数。
下列关于函数原型声明的叙述中,正确的是
在软件开发中,需求分析阶段产生的主要文档是( )。
算法的有穷性是指()。
随机试题
一年以上才能收回的投资是()
谈判空间不利于买方的情形包括()
Alamphung_____thetable.
何谓纤维素性炎症7临床上哪些疾病属于纤维素性炎症?
A.骨组织肿瘤B.软骨组织肿瘤C.纤维组织肿瘤D.骨髓组织肿瘤E.滑膜组织肿瘤lier病属于
工程项目合同之所以是一个合同群体,是因为()。
供应链的强度等于其最强的一个环节。
我国在倡导并实施“一带一路”建设中,注重通过文化及其产业先行来淡化地缘政治效应,旨在促进沿线各国经济联系更加紧密,政治互信更加深入,人文交流更加广泛,不同文明互鉴互荣。这说明()。
有一过程如下:SubSubl(mAsInteger,totalAsLong)DimiASIntegertotal=1Fori=1Tom
Thecollegeofferscoursesinavarietyoftrades.
最新回复
(
0
)