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

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

1、国家二级 C+机试(操作题)-试卷 16 及答案解析(总分:6.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:2.00)1.使用 VC6 打开考生文件夹下的源程序文件 modilcpp,但该程序运行时有错,请改正程序中的错误,使程序输出的结果为: 1 0 注意:错误的语句在*error*的下面,修改该语句即可。 #include struct Struct union int a; char C4; ; int b ; *error* void msin() Struct m; *error* mC0=0 ; mC1=0 ; mC2=0 ; *error* mC3=1 ; mb

2、mc3; coutvoid fun (int a,int n,intb,int m,int*c)void main() int A=3,5,7,9,II,18,21, int B=6,15,19,21,3 9); int C25,i ; for(i=0;ia=a ; this 一b=b; void set(int x,int y) a=x ; b=y; void display() *3* ; int main() CMyFormula formular(1,1); for(int i=1 ; ivoid fun (int a,int n,intb,int m,int*c)void main

3、) int A=3,5,7,9,II,18,21, int B=6,15,19,21,3 9); int C25,i ; for(i=0;ia=a ; this 一b=b; void set(int x,int y) a=x ; b=y; void display() *3* ; int main() CMyFormula formular(1,1); for(int i=1 ; i=9;i+) *4* for(int j=1; j+) formularset(j,i); formulardisplay(); cout_正确答案:(正确答案:(1)添加语句:int a,b; (2)添加语句:

4、CMyFormula(int a=l,int b=1) (3)添加语句: couta*b=1;j+)解析:解析:(1)第 1 个标识下完成 CMyFormula 类的私有变量 a、b 的定义,从函数 set(int X,int y)的参数类型可以看出 a 和 b 均为 int 型变量,故第 1 个标识下应添加“int a,b;”。 (2)第 2 个标识下添加构造函数声明,完成对变量 a、b 赋值,该构造有两个参数 a 和 b,且 a 和 b 缺省值为 1,因此第 2 个标识下应添加“CMyFormula(inta=1,int b=1)”。 (3)打印函数 display()在屏幕上打印出“a*b=c”格式的一个乘法算式,因此第 3 个标识下应添加“couta*b=i,这样保证输出的是倒 99 口诀,因此第 4 个标识下应改为“fortintj=1;j=i j+)”。

展开阅读全文
相关资源
猜你喜欢
  • DIN 564-1995 Hexagon head set screws with small hexagon and half dog point and flat cone point《六角头短圆截锥端紧定螺钉》.pdf DIN 564-1995 Hexagon head set screws with small hexagon and half dog point and flat cone point《六角头短圆截锥端紧定螺钉》.pdf
  • DIN 5651-1979 Brake block holders and brake block keys for composite brake blocks on rail vehicles technical specifications《有轨车辆的复合制动装置的制动块夹持器和制动块键 技术规范》.pdf DIN 5651-1979 Brake block holders and brake block keys for composite brake blocks on rail vehicles technical specifications《有轨车辆的复合制动装置的制动块夹持器和制动块键 技术规范》.pdf
  • DIN 5683-1-2008 Round steel link chains - Buoy chains for mooring of buoys - Part 1 Round steel link chains grade 4《圆钢链 系泊浮筒用浮标链 第1部分 4等级圆钢链》.pdf DIN 5683-1-2008 Round steel link chains - Buoy chains for mooring of buoys - Part 1 Round steel link chains grade 4《圆钢链 系泊浮筒用浮标链 第1部分 4等级圆钢链》.pdf
  • DIN 5683-2-2010 Round steel link chains - Buoy chains for anchoring of buoys - Part 2 Accessories Grade 4《圆钢扁接链 浮标锚链 第2部分 等级4配件》.pdf DIN 5683-2-2010 Round steel link chains - Buoy chains for anchoring of buoys - Part 2 Accessories Grade 4《圆钢扁接链 浮标锚链 第2部分 等级4配件》.pdf
  • DIN 5683-3-2008 Round steel link chains - Buoy chains for mooring of buoys - Part 3 Assemblies《圆钢环节链 浮标系泊用浮标链 第3部分 组装件》.pdf DIN 5683-3-2008 Round steel link chains - Buoy chains for mooring of buoys - Part 3 Assemblies《圆钢环节链 浮标系泊用浮标链 第3部分 组装件》.pdf
  • DIN 5684-1-1984 Calibrated and tested round steel link chains for lifting purposes grade 5《提升用经校准和检验的圆钢链索 5级》.pdf DIN 5684-1-1984 Calibrated and tested round steel link chains for lifting purposes grade 5《提升用经校准和检验的圆钢链索 5级》.pdf
  • DIN 5684-2-1984 Calibrated and tested round steel link chains for lifting purposes grade 6《提升用经校准和检验的圆钢链索 6级》.pdf DIN 5684-2-1984 Calibrated and tested round steel link chains for lifting purposes grade 6《提升用经校准和检验的圆钢链索 6级》.pdf
  • DIN 5684-3-2013 Round steel link chains - Fine tolerance hoist chains - Part 3 Grade T (Types T DAT and DT)《圆钢环节链 精密公差吊链 第3部分 T级 (T型 DAT型和DT型)》.pdf DIN 5684-3-2013 Round steel link chains - Fine tolerance hoist chains - Part 3 Grade T (Types T DAT and DT)《圆钢环节链 精密公差吊链 第3部分 T级 (T型 DAT型和DT型)》.pdf
  • DIN 5685-1-2003 Round steel link chains non proof loaded - Part 1 Long link《未经载荷验证的圆钢扁节链 第1部分 长链》.pdf DIN 5685-1-2003 Round steel link chains non proof loaded - Part 1 Long link《未经载荷验证的圆钢扁节链 第1部分 长链》.pdf
  • 相关搜索

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

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