首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: Name:Smith Age:21 ID:9999
请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: Name:Smith Age:21 ID:9999
admin
2015-07-24
24
问题
请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:
Name:Smith Age:21 ID:99999 CourseNum:12
Record:970
注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。
#include
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 courseNum,float record);
//ERROR **********found**********
void~Studentlnfo(){}
float AverageRecord(){
return Record/CourseNum;
}
void show()const{
cout<<"Name:"<
<<"CourseNum:"<
}
};
//ERROR**********found**********
Studentlnfo Studentlnfo(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;
}
选项
答案
(1)char*Name; (2)~Studentlnfo(){} (3)Studentlnfo::Studentlnfo(char*name,int age,int ID,int courseNum,float record)
解析
(1)主要考查考生对动态数组的掌握,由题目可知Name应该指向一个动态数组,而不是一个有效char型字符,因此要定义成char型指针。
(2)主要考查考生对析构函数的掌握,析构函数不需要函数返回类型,应把void去掉。
(3)主要考查考生对构造函数定义的掌握,构造函数也要使用作用域符号“::”。
转载请注明原文地址:https://kaotiyun.com/show/K0Np777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
()是给对象取一个别名,它引入了对象的同义词。
关于构造函数A()的拷贝构造函数正确的是
假定MyClass为一个类,则执行MyClassa,b(2),*p;语句时,自动调用该类构造函数()次。
一个项目具有一个项目主管,一个项目主管可管理多个项目,则实体“项目主管”与实体“项目”的联系属于【】的联系。
耦合和内聚是评价模块独立性的两个主要标准,其中【】反映了模块内各成分之间的联系。
下面程序的运行结果为#include<iostream.h>voidmain(){chara=’3’;switch(a){case’3’:c
在下面程序的横线处填上适当的语句,使该程序的输出为12。#include<iostream>usingnamespacestd;classBase{public:int
下列变量定义中,合法的是()。
数据库系统阶段的数据具有较高独立性,数据独立性包括物理独立性和【】两个含义。
在下列字符中,不允许作为C++标识符的是()。
随机试题
[背景资料]某施工单位承接的二级公路中有四道单跨2.0×2.0m钢筋混凝土盖板涵,在编制的《施工组织设计》中,对各涵洞的工序划分与工序的工作时间分析如表2B320020—1所示。施工单位最初计划采用顺序作业法组织施工,报监理审批时,监理
有n个进程都要使用某个共享文件,但系统限制最多可以有m个进程(n>m>1)同时读文件。用PV操作管理时,信号量的值不可能变化为
改革的特征是()。
Trainingastronauts______notaneasything.
妇女为防止非意愿妊娠的发生而采用的紧急避孕药物有()。
直接故意与间接故意的区别是:
依据《煤矿安全监察条例》,煤矿安全监察人员发现煤矿矿长或者其他主管人员违章指挥工人或者强令工人违章、冒险作业,应采取的措施是()。
关于矿山井下的防尘措施,说法错误的是()。
自行车比赛常见的场地赛项目有个人赛和()。
①在这种形势下,西方出现了青年现象的退潮,表现为批判能力的下降,青年人安于现状②现实呼吁青年精神的回归,无论解决问题的创造性,还是对历史使命的担当,希望还在青年③新的思想创造了青年,青年创造了新的时代④但从世界范围内来看,自从
最新回复
(
0
)