问答题
请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:Name:SmithAge:21ID:99999CourseNum:12Record:970注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。#include<iostream>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:¨<<Name<<"Age:"<<Age<<"ID:"<<ID<<"CourseNum:"<<CourseNum<<”Record:"<<Record<<end1; }};//ERROR**********found**********StudentInfoStudentInfo(char*Name,intAge,intID,intCourseNumlfloatRecord){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::Stude......
(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)