【计算机类职业资格】二级C语言机试-104及答案解析.doc

上传人:tireattitude366 文档编号:1325617 上传时间:2019-10-17 格式:DOC 页数:6 大小:31KB
下载 相关 举报
【计算机类职业资格】二级C语言机试-104及答案解析.doc_第1页
第1页 / 共6页
【计算机类职业资格】二级C语言机试-104及答案解析.doc_第2页
第2页 / 共6页
【计算机类职业资格】二级C语言机试-104及答案解析.doc_第3页
第3页 / 共6页
【计算机类职业资格】二级C语言机试-104及答案解析.doc_第4页
第4页 / 共6页
【计算机类职业资格】二级C语言机试-104及答案解析.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、二级 C 语言机试-104 及答案解析(总分:100.00,做题时间:90 分钟)一、填空题(总题数:1,分数:33.00)1.数组 xxN保存着一组 3 位数的无符号正整数,其元素的个数通过变量 num 传入函数 fun()。请补充函数 fun(),该函数的功能是:从数组 xx 中找出个位和百位的数字相等的所有无符号整数,结果保存在数组 yy 中,其个数由函数 fun()返回。例如:当 xx8=135,78,72,32,222,424,333,141,541 时, bb6=787,232,222,424,333,141。注意:部分源程序给出如下。请勿改动主函数 main 和其他函数中的任何内

2、容,仅在函数 fun()的横线上填入所编写的若干表达式或语句。试题程序:#include conio.h#define N 1000int fun(int xx,int bb,int num)int i,n=0;int g,b;for(i=0;inum;i+)g= 【1】 ;b=xxi/100;if(g=b)【2】 ;return 【3】 ;main()int xx8=135,787,232,222,424,333,141,541;int YYN;int num=0,n=0,i=0;num=8;clrscr();printf(“* original data */n“);for(i=0;inu

3、m;i+)printf(“%u“,xxi);printf(“/n/n/n“);n=fun(xx,yy,num);printf(“/nyy=“);for(i=0;in;i+)printf(“%u“,YYi);(分数:33.00)填空项 1:_二、改错题(总题数:1,分数:33.00)2.下列给定程序中函数 fun()的功能是计算 1/n!的值。例如:给 n 输入 5,则输出 0.0083330请改正程序中的错误,使它能得到正确结果。注意:不要改动 main 函数,不得增行或删行,也不得更改程序的结构。试题程序:#include stdio.h#include conio.h/*+*found*/

4、int fun(int n)double result=1.0;if(n=0)return 1.0;while(n1 int i;for(i=0;in;i+) /*从 0n 中找到既能被 5 整除同时又能被 11 整除的数,并将这些数求和*/if(i%5=0s=sqrt(s); /*对 s 求平方根*/return s;)解析:解析本题的解题思路是逐个取得从。0-n 之间的所有数,对每次取得的数进行条件判断,条件是既能被 5 整除同时又能被 11 整除,注意:这两个条件要求同时成立,因此用到了“&”运算符。满足条件,该数就被累加到 s 中去,求出所有符合条件的数后,用 sqrt()函数(包含于头文件math.h中)对s 求平方根。

展开阅读全文
相关资源
猜你喜欢
  • NASA NACA-WR-L-445-1941 Wind-tunnel investigation of perforated split flaps for use as dive brakes on a rectangular NACA 23012 airfoil《矩形NACA 23012机翼上作为俯冲制动器使用的穿孔分裂式襟翼的风洞研究》.pdf NASA NACA-WR-L-445-1941 Wind-tunnel investigation of perforated split flaps for use as dive brakes on a rectangular NACA 23012 airfoil《矩形NACA 23012机翼上作为俯冲制动器使用的穿孔分裂式襟翼的风洞研究》.pdf
  • NASA NACA-WR-L-447-1943 Wind-tunnel investigation of control-surface characteristics XI - various large overhang and internal-type aerodynamic balances for a straight-contour flap .pdf NASA NACA-WR-L-447-1943 Wind-tunnel investigation of control-surface characteristics XI - various large overhang and internal-type aerodynamic balances for a straight-contour flap .pdf
  • NASA NACA-WR-L-454-1942 Wind-tunnel investigation of control-surface characteristics VI - a 30-percent-chord plain flap on the NACA 0015 airfoil《操纵面特性VI的风洞研究 NACA 0015机翼上的30%弦普通襟翼》.pdf NASA NACA-WR-L-454-1942 Wind-tunnel investigation of control-surface characteristics VI - a 30-percent-chord plain flap on the NACA 0015 airfoil《操纵面特性VI的风洞研究 NACA 0015机翼上的30%弦普通襟翼》.pdf
  • NASA NACA-WR-L-464-1942 Wind-tunnel investigation of control-surface characteristics V - the use of a beveled trailing edge to reduce the hinge moment of a control surface《操纵面特性V的风.pdf NASA NACA-WR-L-464-1942 Wind-tunnel investigation of control-surface characteristics V - the use of a beveled trailing edge to reduce the hinge moment of a control surface《操纵面特性V的风.pdf
  • NASA NACA-WR-L-489-1940 Drag analysis of single-engine military airplanes tested in the NACA full-scale wind tunnel《在NACA全比例风洞中试验的单发动机军用飞机的阻力分析》.pdf NASA NACA-WR-L-489-1940 Drag analysis of single-engine military airplanes tested in the NACA full-scale wind tunnel《在NACA全比例风洞中试验的单发动机军用飞机的阻力分析》.pdf
  • NASA NACA-WR-L-511-1943 Wind-tunnel investigation of control-surface characteristics XII - various cover-plate alinements on the NACA 0015 airfoil with a 30-percent-chord flap and .pdf NASA NACA-WR-L-511-1943 Wind-tunnel investigation of control-surface characteristics XII - various cover-plate alinements on the NACA 0015 airfoil with a 30-percent-chord flap and .pdf
  • NASA NACA-WR-L-628-1944 Tests of the Northrop MX-334 glider airplane in the NACA full-scale tunnel《在NACA全面风洞中的诺斯罗普MX-334滑翔机试验》.pdf NASA NACA-WR-L-628-1944 Tests of the Northrop MX-334 glider airplane in the NACA full-scale tunnel《在NACA全面风洞中的诺斯罗普MX-334滑翔机试验》.pdf
  • NASA NACA-WR-L-662-1943 Tests of two models representing intermediate inboard and outboard wing sections of the XB-36 airplane《两架展示XB-36飞机中间内翼和外翼截面模型的试验》.pdf NASA NACA-WR-L-662-1943 Tests of two models representing intermediate inboard and outboard wing sections of the XB-36 airplane《两架展示XB-36飞机中间内翼和外翼截面模型的试验》.pdf
  • NASA NACA-WR-L-67-1944 The effect of internal pressure on the buckling stress of thin-walled circular cylinders under torsion《内部压力对在扭力下薄壁圆形汽缸的屈曲应力影响》.pdf NASA NACA-WR-L-67-1944 The effect of internal pressure on the buckling stress of thin-walled circular cylinders under torsion《内部压力对在扭力下薄壁圆形汽缸的屈曲应力影响》.pdf
  • 相关搜索

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

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