[计算机类试卷]国家二级(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。 然后求得阶乘分之一的累加和。

展开阅读全文
相关资源
猜你喜欢
  • BS ISO IEC 15145-1997 Information technology - Programming languages - FORTH《信息技术 程序设计语言 FORTH语言》.pdf BS ISO IEC 15145-1997 Information technology - Programming languages - FORTH《信息技术 程序设计语言 FORTH语言》.pdf
  • BS ISO IEC 15149-2-2015 Information technology Telecommunications and information exchange between systems Magnetic field area network (MFAN) In-band Control Protocol for .pdf BS ISO IEC 15149-2-2015 Information technology Telecommunications and information exchange between systems Magnetic field area network (MFAN) In-band Control Protocol for .pdf
  • BS ISO IEC 15149-3-2016 Information technology Telecommunications and information exchange between systems Magnetic field area network (MFAN) Relay Protocol for Extended R.pdf BS ISO IEC 15149-3-2016 Information technology Telecommunications and information exchange between systems Magnetic field area network (MFAN) Relay Protocol for Extended R.pdf
  • BS ISO IEC 15149-4-2016 Information technology Telecommunications and information exchange between systems Magnetic field area network (MFAN) Security Protocol for Authent.pdf BS ISO IEC 15149-4-2016 Information technology Telecommunications and information exchange between systems Magnetic field area network (MFAN) Security Protocol for Authent.pdf
  • BS ISO IEC 1539-1-2010 Information technology Programming languages Fortran Base language《信息技术 程序设计语言 Fortran语言 基础语言》.pdf BS ISO IEC 1539-1-2010 Information technology Programming languages Fortran Base language《信息技术 程序设计语言 Fortran语言 基础语言》.pdf
  • BS ISO IEC 1539-2-2000 Information technology - Programming languages - FORTRAN - Varying length character strings《信息技术 编程语言 FORTRAN语言 变化长度字符串》.pdf BS ISO IEC 1539-2-2000 Information technology - Programming languages - FORTRAN - Varying length character strings《信息技术 编程语言 FORTRAN语言 变化长度字符串》.pdf
  • BS ISO IEC 15414-2015 Information technology Open distributed processing Reference model Enterprise language《信息技术 开放型分布式处理 标准模式 企业语言》.pdf BS ISO IEC 15414-2015 Information technology Open distributed processing Reference model Enterprise language《信息技术 开放型分布式处理 标准模式 企业语言》.pdf
  • BS ISO IEC 15417-2007 Information technology - Automatic identification and data capture techniques - Code 128 bar code symbology specification《信息技术 自动识别和数据捕捉技术 代码128条形码符号.pdf BS ISO IEC 15417-2007 Information technology - Automatic identification and data capture techniques - Code 128 bar code symbology specification《信息技术 自动识别和数据捕捉技术 代码128条形码符号.pdf
  • BS ISO IEC 15418-2016 Information technology Automatic identification and data capture techniques GS1 Application Identifiers and ASC MH10 Data Identifiers and maintenance.pdf BS ISO IEC 15418-2016 Information technology Automatic identification and data capture techniques GS1 Application Identifiers and ASC MH10 Data Identifiers and maintenance.pdf
  • 相关搜索

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

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