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

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

1、国家二级 C语言机试(操作题)模拟试卷 144及答案与解析 一、程序填空题 1 函数 fun的功能是:把形参 a所指数组中的偶数按原顺序依次存放到 a0、a1、 a2、 中,把奇数从数组中删除,偶数个数通过函数值返回。例如: 若 a所指数组中的数据最初排列为: 9、 1、 4、 2、 3、 6、 5、 8、 7,删除奇数后a所指数组中的数据为: 4、 2、 6、 8,返回值为 4。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANK1 C中。 不得增行或删行,也不得更改程序的结构 ! #include #defirte N 9

2、int fun(int a, int n) int i, j; j=0; for (i=0; i void fun(char *a, int n) main() char s81; int n; void NONO(); printf(“Enter a string: n“); gets(s); printf(“Enter rl: “); scanf(“ d“, n); fun(s, n); printf(“The string after deleted: n“。 ); puts(s); NONO(), void NONO() *本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。

3、 FILE *in, *out; int i, n; char s81; in=fopen(“in dat“, “r“); out=fopen(“out dat“, “w“); for(i=0; in) 对统计的 “*”号数目大于给定的 “*”号总数 n while(*p&pt+n) 当超出给定的 “*”号数目,则开始进行截取 ai=*p; 截取 n个 “*”号 i+; p+; ai= 0; 对新生成的串加尾符 【试题解析】 解题过程首先确定字符串尾,然后由串尾开始对字符进行判断,同时对 “*”字符进行统计,如果大于 n,就进行截取。 (1)首先确定字符串的尾,然后判断 “*”号字符,并对字符串中的字符进行判断,如果字符是符号 “*”则对 “*”,号进行统计。 (2)根据统计的 “*”号数目结合题目中对 “*”号个数的要求,判断是执行对 “*”号的截取操作,还是什么都不用做。 (3)所有字符处理完后,记得在新串 s的末尾加上结束符 “ 0”。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 4245-1995 Aerospace Series Heat Resisting Alloy FE-PM1708 Vacuum Arc Remelted As Forged Forging Stock De is Less Than or Equal to 300 mm Edition P 1《航空系列 抗热合金FE-PM1708真空.pdf AECMA PREN 4245-1995 Aerospace Series Heat Resisting Alloy FE-PM1708 Vacuum Arc Remelted As Forged Forging Stock De is Less Than or Equal to 300 mm Edition P 1《航空系列 抗热合金FE-PM1708真空.pdf
  • AECMA PREN 4246-1995 Aerospace Series Heat Resisting Alloy CO-PH4101 Vacuum Melted as Forged Forging Stock De is Less Than or Equal to 360 mm Edition P 1《航空系列 抗热合金CO-PH4101真空熔制铸件De.pdf AECMA PREN 4246-1995 Aerospace Series Heat Resisting Alloy CO-PH4101 Vacuum Melted as Forged Forging Stock De is Less Than or Equal to 360 mm Edition P 1《航空系列 抗热合金CO-PH4101真空熔制铸件De.pdf
  • AECMA PREN 4247-2003 Aerospace Series Aluminium Alloy AL-P2024-T42 Plate 6mm less than a Less Than or Equal to 140 mm Edition P 2《航空系列 AL-P2024-T42型铝合金6mm小于或等于a小于或等于140mm的金属板.P2版》.pdf AECMA PREN 4247-2003 Aerospace Series Aluminium Alloy AL-P2024-T42 Plate 6mm less than a Less Than or Equal to 140 mm Edition P 2《航空系列 AL-P2024-T42型铝合金6mm小于或等于a小于或等于140mm的金属板.P2版》.pdf
  • AECMA PREN 4248-1996 Aerospace Series Nuts Anchor Self-Locking Fixed Single Lug with Counterbore in Heat Resisting Steel Silver Plated Classification  1 100 MPa (at Ambient Tempera.pdf AECMA PREN 4248-1996 Aerospace Series Nuts Anchor Self-Locking Fixed Single Lug with Counterbore in Heat Resisting Steel Silver Plated Classification 1 100 MPa (at Ambient Tempera.pdf
  • AECMA PREN 4249-1996 Aerospace Series Nuts Anchor Self-Locking Fixed Single Lug Reduced Series with Counterbore in Heat Resisting Steel Silver Plated Classification  1 100 MPa (at .pdf AECMA PREN 4249-1996 Aerospace Series Nuts Anchor Self-Locking Fixed Single Lug Reduced Series with Counterbore in Heat Resisting Steel Silver Plated Classification 1 100 MPa (at .pdf
  • AECMA PREN 4250-2001 Aerospace Series Nickel Base Alloy NI-B41001 Filler Metal for Brazing Amorphous Foil Edition P 2《航空系列 镍合金NI-B41001填充金属铜焊无定形金属薄片.P2版取代.P1版》.pdf AECMA PREN 4250-2001 Aerospace Series Nickel Base Alloy NI-B41001 Filler Metal for Brazing Amorphous Foil Edition P 2《航空系列 镍合金NI-B41001填充金属铜焊无定形金属薄片.P2版取代.P1版》.pdf
  • AECMA PREN 4251-1997 Aerospace Series Nuts Anchor Self-Locking Fixed 90 Degree Corner with Counterbore in Heat Resisting Steel Silver Plated Classification  1 100 MPa (at Ambient T.pdf AECMA PREN 4251-1997 Aerospace Series Nuts Anchor Self-Locking Fixed 90 Degree Corner with Counterbore in Heat Resisting Steel Silver Plated Classification 1 100 MPa (at Ambient T.pdf
  • AECMA PREN 4252-1997 Aerospace Series Nuts Anchor Self-Locking Fixed 90 Degree Corner Reduced Series with Counterbore in Heat Resisting Steel Silver Plated Classification  1 100 MP.pdf AECMA PREN 4252-1997 Aerospace Series Nuts Anchor Self-Locking Fixed 90 Degree Corner Reduced Series with Counterbore in Heat Resisting Steel Silver Plated Classification 1 100 MP.pdf
  • AECMA PREN 4253-1997 Aerospace Series Nuts Anchor Self-Locking Fixed Closed Corner Reduced Series with Counterbore in Heat Resisting Steel Silver Plated Classification  1 100 MPa (.pdf AECMA PREN 4253-1997 Aerospace Series Nuts Anchor Self-Locking Fixed Closed Corner Reduced Series with Counterbore in Heat Resisting Steel Silver Plated Classification 1 100 MPa (.pdf
  • 相关搜索

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

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