【计算机类职业资格】国家二级C++机试(操作题)模拟试卷382及答案解析.doc
-
资源ID:1331880
资源大小:37KB
全文页数:4页
- 资源格式: DOC
下载积分:5000积分
快捷下载

账号登录下载
微信登录下载
下载资源需要5000积分(如需开发票,请勿充值!)
友情提示
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
|
【计算机类职业资格】国家二级C++机试(操作题)模拟试卷382及答案解析.doc
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有多个成员函数,完成学生数据输入、排序、查找最好成绩和打印等功能。