[计算机类试卷]国家二级(C语言)机试模拟试卷253及答案与解析.doc

上传人:feelhesitate105 文档编号:503002 上传时间:2018-11-29 格式:DOC 页数:5 大小:29.50KB
下载 相关 举报
[计算机类试卷]国家二级(C语言)机试模拟试卷253及答案与解析.doc_第1页
第1页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷253及答案与解析.doc_第2页
第2页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷253及答案与解析.doc_第3页
第3页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷253及答案与解析.doc_第4页
第4页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷253及答案与解析.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级( C语言)机试模拟试卷 253及答案与解析 一、程序填空题( 30分) 1 给定程序中,函数 fun的功能是:将 s所指字符串中的所有数字字符移到所有非数字字符之后,并保持数字字符串和非数字字符串原有的先后次序。例如,形参 s所指的字符串为: def35adh3ksdf7。执行结果为: defadhkjsdf3537。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANKl C中。 不得增行或删行,也不得更改程序的结构 ! #include void fun(char *s) int i, j=0, k=0; char

2、t180, t280; for(i=0; si!=0; i+) if(si=0 char *p , *r; n=0; while (*s) p=s; /*found*/ r=t; while(*r) if(*r=*p) r+; p+; else break; /*found*/ if(*r=0) n+; s+; return n; main() char aN,bN; int m; printf(“nPlease enter string a : “); gets(a); printf(“nPlease enter substring b : “); gets(b); m=fun(a, b);

3、 printf(“nThe result is : m = %dn“,m); 三、程序设计题( 40分) 3 请编写函数 fun(),其功能是计算并输出下列多项式的值: F=1+1 1!+1 2!+1 3!+1 4!+1 m! 例如,若主函数从键盘给键盘给 m输入 5,则输出为 F=2 716667。 注意: m的值要求大于 1但不大于 100。部分源程序给出如下。 请勿改动 main()函数与其他函数中的任何内容,仅在函数 fun()的花括号中填入所编写的若干语句。 试题程序: #include double fun(int m) void main() int m; double f; FILE * out; printf(“Input m: “); scanf(“ d“, &m); f=fun(m); printf(“F= f n“, f); out: fopen(“outfile dat“, “w“); for(m=10; m1) m!=1(m=1) 公式分为参数 m是 1和大于 1的两种情况,例如, 1的阶乘 1!=1; 5的阶乘5!=5*4*3*2*1。 然后求得阶乘分之一的累加和。

展开阅读全文
相关资源
猜你喜欢
  • ANSI ASA S12.11 PART 1-2013 American National Standard Acoustics C Measurement of airborne noise emitted and structure  borne vibration induced by small air-moving devices C Part 1.pdf ANSI ASA S12.11 PART 1-2013 American National Standard Acoustics C Measurement of airborne noise emitted and structure borne vibration induced by small air-moving devices C Part 1.pdf
  • ANSI ASA S12.11 PART 2-2013 American National Standard Acoustics C Measurement of airborne noise emitted and structure-borne vibration induced by small air-moving devices C Part 2 .pdf ANSI ASA S12.11 PART 2-2013 American National Standard Acoustics C Measurement of airborne noise emitted and structure-borne vibration induced by small air-moving devices C Part 2 .pdf
  • ANSI ASA S12.12-1992 American National Standard Engineering Method for the Determination of Sound Power Levels of Noise Sources Using Sound Intensity《利用声音强度测定噪声源声功率级别的工程法》.pdf ANSI ASA S12.12-1992 American National Standard Engineering Method for the Determination of Sound Power Levels of Noise Sources Using Sound Intensity《利用声音强度测定噪声源声功率级别的工程法》.pdf
  • ANSI ASA S12.13 TR-2002 American National Standard Evaluating the Effectiveness of Hearing Conservation Programs through Audiometric Data Base Analysis.pdf ANSI ASA S12.13 TR-2002 American National Standard Evaluating the Effectiveness of Hearing Conservation Programs through Audiometric Data Base Analysis.pdf
  • ANSI ASA S12.14-1992 American National Standard Methods for the Field Measurement of the Sound Output of Audible Public Warning Devices Installed at Fixed Locations Outdoors《室外固定位置.pdf ANSI ASA S12.14-1992 American National Standard Methods for the Field Measurement of the Sound Output of Audible Public Warning Devices Installed at Fixed Locations Outdoors《室外固定位置.pdf
  • ANSI ASA S12.15-1992 AMERICAN NATIONAL STANDARD For Acoustics C Portable Electric Power Tools Stationary and Fixed Electric Power Tools and Gardening Appliances C Measurement of So.pdf ANSI ASA S12.15-1992 AMERICAN NATIONAL STANDARD For Acoustics C Portable Electric Power Tools Stationary and Fixed Electric Power Tools and Gardening Appliances C Measurement of So.pdf
  • ANSI ASA S12.17-1996 American National Standard Impulse Sound Propagation for Environmental Noise Assessment《环境噪声评定用脉动声音传播》.pdf ANSI ASA S12.17-1996 American National Standard Impulse Sound Propagation for Environmental Noise Assessment《环境噪声评定用脉动声音传播》.pdf
  • ANSI ASA S12.18-1994 American National Standard Procedures for Outdoor Measurement of Sound Pressure Level《室外测量声压级的美国国家标准规程》.pdf ANSI ASA S12.18-1994 American National Standard Procedures for Outdoor Measurement of Sound Pressure Level《室外测量声压级的美国国家标准规程》.pdf
  • ANSI ASA S12.19-1996 American National Standard Measurement of Occupational Noise Exposure《职业噪声暴露的测量》.pdf ANSI ASA S12.19-1996 American National Standard Measurement of Occupational Noise Exposure《职业噪声暴露的测量》.pdf
  • 相关搜索

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

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