【计算机类职业资格】国家二级C++机试(操作题)模拟试卷382及答案解析.doc

上传人:priceawful190 文档编号:1331880 上传时间:2019-10-17 格式:DOC 页数:4 大小:37KB
下载 相关 举报
【计算机类职业资格】国家二级C++机试(操作题)模拟试卷382及答案解析.doc_第1页
第1页 / 共4页
【计算机类职业资格】国家二级C++机试(操作题)模拟试卷382及答案解析.doc_第2页
第2页 / 共4页
【计算机类职业资格】国家二级C++机试(操作题)模拟试卷382及答案解析.doc_第3页
第3页 / 共4页
【计算机类职业资格】国家二级C++机试(操作题)模拟试卷382及答案解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级 C+机试(操作题)模拟试卷 382及答案解析(总分:6.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:2.00)1.使用 VC6打开考生文件夹下的源程序文件 modilcpp,但该程序运行时有错,请改正程序中的错误,使程序输出的结果为: i=5 i=10 i=15 i=20 注意:错误的语句在*error*的下面,修改该语句即可。 #include class CMyClass public: template void func(T x,T Y) *error* T i=0; if(x=i) i=i+x; else i=i+y; coutname; innumber

2、 inmark; mcount+; m pStui=new Student (name,number,mark); cout m_pStuindex-mmark) index=j; *2* if() Student*ps=m pStui; m_pStui=m_pStu index; mpStuindex=ps; void Teacher:Display() cout m pStuindex一m mark) count=1; index=j; pScount+=m pStu index; else if(m_pstujmmark =m_pStuindex一m_mark) index=j; pS

3、count+=m pStu index; return count; void main() Teacher Teacher; Student*pStudentNMAX; cout=i) i=i+x; else i=i+y; coutname; innumber; inmark; mcount+; m pStui=new Student (name,number,mark); cout m_pStuindex-mmark) index=j; *2* if() Student*ps=m pStui; m_pStui=m_pStu index; mpStuindex=ps; void Teache

4、r:Display() cout m pStuindex一m mark) count=1; index=j; pScount+=m pStu index; else if(m_pstujmmark =m_pStuindex一m_mark) index=j; pScount+=m pStu index; return count; void main() Teacher Teacher; Student*pStudentNMAX; cout“输入的学生信息:”endl“排序后的学生信息:”endl“查询成绩最高的学生信息:” 9isplayMsg(); (分数:2.00)_正确答案:(正确答案:(1)添加语句:friend ClasS Teacher; (2)将“if()”补充完整为: if(i ndex!:j) (3)添加语句:pS0=m pStu0;)解析:解析:类 Student含有三个成员变量:姓名、五个英文字符的学号和精确到小数点后一位的一科成绩,类 Teacher含有 Student对象数组的指针 Student*m_pStuNMAX、m_average 和 mcount三个成员变量,类 Teacher有多个成员函数,完成学生数据输入、排序、查找最好成绩和打印等功能。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 考试资料 > 职业资格

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1