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

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

1、国家二级( C语言)机试模拟试卷 249及答案与解析 一、程序填空题( 30分) 1 给定程序中,函数 fun的功能是:将形参 n所指变量中,各位上为偶数的数去除,剩余的数按原来从高位到低位的顺序组成一个新的数,并通过形参指针 n传回所指变量。 例如,输入一个数: 27638496,新的数:为 739。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANK C中。 不得增行或删行,也不得更改程序的结构 ! #include void fun(unsigned long*n) unsigned Long x=0, i; int t;

2、 i=l; while(*n) *found* t=*n 【 1】; *found* if(t 2 !=【 2】 ) x=x+t(i; i=i*10; *n=*n 10; *found* *n= 【 3】; main() unsiqned long n=一 1; while(n99999999| n int fun(int *b) int k, a1, a2, i=0; for(k=10; k void fun(char *a,int n) main() char s81; int n; void NONO (); printf(“Enter a string:n“);gets(s); pri

3、ntf(“Enter n : “);scanf(“%d“, fun(s,n); printf(“The string after deleted:n“);puts(s); NONO(); void NONO() /* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FILE *in, *out ; int i, n ; char s81 ; in = fopen(“in.dat“,“r“); out = fopen(“out.dat“,“w“); for(i = 0 ; i n) /对统计的 “*“号数目大于给定的 “*“号总数 n while(*p /截取 n个 “*“号 i+; p+; ai=0; /对新生成的串加尾符 【试题解析】 ( 1)首先确定字符串的尾,然后判断 “*”号字符,并对字符串中的字符进行判断,如果字符是符号 “*”则对 “*”号进行统计。 ( 2)根据统计的 “*”号数目结合题目中对 “*”号个数的要求,判断是执行对 “*”号的截取操作,还是什么都不用做。 ( 3)所有字符处理完后,记得在新串 s的末尾加上结束符 “0”。

展开阅读全文
相关资源
猜你喜欢
  • BS PD IEC TR 61857-2-2015 Electrical insulation systems Procedures for thermal evaluation Selection of the appropriate test method for evaluation and classification of ele.pdf BS PD IEC TR 61857-2-2015 Electrical insulation systems Procedures for thermal evaluation Selection of the appropriate test method for evaluation and classification of ele.pdf
  • BS PD IEC TR 61869-100-2017 Instrument transformers Guidance for application of current transformers in power system protection《仪表互感器 保护电力系统的电流互感器应用指南 》.pdf BS PD IEC TR 61869-100-2017 Instrument transformers Guidance for application of current transformers in power system protection《仪表互感器 保护电力系统的电流互感器应用指南 》.pdf
  • BS PD IEC TR 61869-102-2014 Instrument transformers Ferroresonance oscillations in substations with inductive voltage transformers《仪表用变压器 带有电磁式电压变压器的变电站中的铁磁谐振振幅》.pdf BS PD IEC TR 61869-102-2014 Instrument transformers Ferroresonance oscillations in substations with inductive voltage transformers《仪表用变压器 带有电磁式电压变压器的变电站中的铁磁谐振振幅》.pdf
  • BS PD IEC TR 61916-2017 Electrical accessories - Harmonization of general rules《电器附件 通用规则协调》.pdf BS PD IEC TR 61916-2017 Electrical accessories - Harmonization of general rules《电器附件 通用规则协调》.pdf
  • BS PD IEC TR 61948-1-2016 Nuclear medicine instrumentation Routine tests Gamma radiation counting system《核医疗设备 常规试验 第1部分 伽玛辐射计数系统》.pdf BS PD IEC TR 61948-1-2016 Nuclear medicine instrumentation Routine tests Gamma radiation counting system《核医疗设备 常规试验 第1部分 伽玛辐射计数系统》.pdf
  • BS PD IEC TR 61967-1-1-2015 Integrated circuits Measurement of electromagnetic emissions General conditions and definitions Near-field scan data exchange format《集成电路 电磁辐射管.pdf BS PD IEC TR 61967-1-1-2015 Integrated circuits Measurement of electromagnetic emissions General conditions and definitions Near-field scan data exchange format《集成电路 电磁辐射管.pdf
  • BS PD IEC TR 61968-900-2015 Application integration at electric utilities System interfaces for distribution management Guidance for implementation of IEC 61968-9《电力事业应用集成.pdf BS PD IEC TR 61968-900-2015 Application integration at electric utilities System interfaces for distribution management Guidance for implementation of IEC 61968-9《电力事业应用集成.pdf
  • BS PD IEC TR 61998-2015 Model and framework for standardization in multimedia equipment and systems《多媒体设备与系统标准化的模型和框架》.pdf BS PD IEC TR 61998-2015 Model and framework for standardization in multimedia equipment and systems《多媒体设备与系统标准化的模型和框架》.pdf
  • BS PD IEC TR 62001-1-2016 High-voltage direct current (HVDC) systems Guidance to the specification and design evaluation of AC filters Overview《高压直流 (HVDC) 系统 交流滤波器的规格和设计评.pdf BS PD IEC TR 62001-1-2016 High-voltage direct current (HVDC) systems Guidance to the specification and design evaluation of AC filters Overview《高压直流 (HVDC) 系统 交流滤波器的规格和设计评.pdf
  • 相关搜索

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

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