[计算机类试卷]国家三级信息管理技术机试模拟试卷5及答案与解析.doc

上传人:syndromehi216 文档编号:494988 上传时间:2018-11-28 格式:DOC 页数:3 大小:27.50KB
下载 相关 举报
[计算机类试卷]国家三级信息管理技术机试模拟试卷5及答案与解析.doc_第1页
第1页 / 共3页
[计算机类试卷]国家三级信息管理技术机试模拟试卷5及答案与解析.doc_第2页
第2页 / 共3页
[计算机类试卷]国家三级信息管理技术机试模拟试卷5及答案与解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家三级信息管理技术机试模拟试卷 5及答案与解析 一、程序设计题 1 函数 ReadDat()的功能是实现从文件 IN5.DAT中读取一篇英文文章存入到字符串数组 xx中。请编制函数 ConvertCharA(),该函数的功能是:以行为单位把字符串中的所有小写字母改写成该字母的下一个字母,如果是字母 2,则改写成字母 a。大写字母仍为大写字母,小写字母仍为小写字母,其他字符不变。把已处理的字符串仍按行重新存入字符串数组 xx中,最后调用函数 WriteDat()把结果 xx输出到文件 OUT5.DAT中。 例如,原文: Adb.Bcdza abck LLhj 结果: Aec.Bdeab bcd

2、l.LLik 原始数据文件存放的格式是:每行的宽度均小于 80个字符,含标点符号和空格。 注意:部分源程序已给出。 请勿改动主函数 main()、读函数 ReadDat()和写函数 Wiltedat()的内容。 试题程序: #include stdio.h #include string.h #include conio.h char xx50 80; int maxline = 0;/* 文章的总行数 */ int ReadDat (void); void WriteDat (void); void ConvertCharA (void) main ( ) clrscr(); if(Read

3、Dat() printf(“数据文件 IN5.DAT不能打开 !n007“); return; ConvertCharA(); WriteDat(); int ReadDat(void) FILE *fp; int i =0; char *p; if(fp = fopen(“IN5.DAT“, “r“) = NULL) return 1; while(fgets(xxi, 80, fp) !=NULL) p = strchr(xxi, n); if(p) *p = 0; i+; maxline = i; fclose(fp); return 0; void WriteDat(void) FIL

4、E *fp; int i; clrscr(); fp = fopen(“OUT5.DAT“, “w“); for(i = 0; i maxline; i+) printf(“%skn“, xxi); fprintf(fp, “%skn“, xxi); fclose(fp); 国家三级信息管理技术机试模拟试卷 5答案与解析 一、程序设计题 1 【正确答案】 void ConvertCharA (void) int i, j,str; for (i=0; i maxline; i+) str=strlen (xx i ); /*求得当前行的字符串的长度 */ for (j=0; j str; j+

5、) if (xxi j=z) xxi j=a; /*如果遇到的字符是小写字母 z则改写成小写字母 a* / else if(xxij =a /*如果该字符是从 a到 y的小写字母则改写为该字母的下一个字母 */ 【试题解析】 本题要对二维数组中的字符元素按行来处理,因此,首先要求得当前行所包含的字符总个数,之后才可以利用一个循环来 依次访问该行中的所有字符。当遇到一个字符时,先判断该字符是否是小写字母 2,如果是,则把该字符改写成小写字母 a;如果不是,则继续判断该字符是否是从 a到 y的小写字母,如果是,则改写为该字母的下一个字母 (利用字符的 ASCII码值来实现 );如果不是,则不做任何的操作,接着去取下一个字符。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 3466-1994 Aerospace Series Titanium Alloy TI-P63001 Solution Treated and Aged Bar for Machining D Less Than or Equal to 150 mm Edition P 2《航空航天系列.钛合金 TI-P63001溶液处理和老化棒材直.pdf AECMA PREN 3466-1994 Aerospace Series Titanium Alloy TI-P63001 Solution Treated and Aged Bar for Machining D Less Than or Equal to 150 mm Edition P 2《航空航天系列.钛合金 TI-P63001溶液处理和老化棒材直.pdf
  • AECMA PREN 3467-1996 Aerospace Series Titanium Alloy TI-C64001 not Heat Treated Remelting Stock De Less Than or Equal to 300 mm Edition P 2《航空航天系列.钛合金 TI-C64001非热处理重熔锻件De小于或等于300 m.pdf AECMA PREN 3467-1996 Aerospace Series Titanium Alloy TI-C64001 not Heat Treated Remelting Stock De Less Than or Equal to 300 mm Edition P 2《航空航天系列.钛合金 TI-C64001非热处理重熔锻件De小于或等于300 m.pdf
  • AECMA PREN 3468-1988 Aerospace Series Steel FE-PA13 Softened 500 Less Than or Equal to Rm Less Than or Equal to 700 MPa Forgings De Less Than or Equal to 100 mm Issue P 1《航空航天系列.钢F.pdf AECMA PREN 3468-1988 Aerospace Series Steel FE-PA13 Softened 500 Less Than or Equal to Rm Less Than or Equal to 700 MPa Forgings De Less Than or Equal to 100 mm Issue P 1《航空航天系列.钢F.pdf
  • AECMA PREN 3469-2000 Aerospace Series Steel FE-PM1802 (X5CrNiCu15-5) Consumable Electrode Remelted Solution Treated and Precipitation Treated Forgings a or D Less than or Equal to t.pdf AECMA PREN 3469-2000 Aerospace Series Steel FE-PM1802 (X5CrNiCu15-5) Consumable Electrode Remelted Solution Treated and Precipitation Treated Forgings a or D Less than or Equal to t.pdf
  • AECMA PREN 3470-1998 Aerospace Series Steel FE-PM1503 (X3CrNiMoAI13-8-2) Vacuum Induction Melted and Consumable Electrode Remelted Solution Treated and Precipitation Treated Forgin.pdf AECMA PREN 3470-1998 Aerospace Series Steel FE-PM1503 (X3CrNiMoAI13-8-2) Vacuum Induction Melted and Consumable Electrode Remelted Solution Treated and Precipitation Treated Forgin.pdf
  • AECMA PREN 3471-1988 Aerospace Series Steel FE-PA18 Quenched and Cold Drawn Strip for Spring a Less Than or Equal to 4 0 mm Issue P 1《航空航天系列.钢FE-PA18卒火和冷拉带用于弹簧a小于或等于4 0mm P1板》.pdf AECMA PREN 3471-1988 Aerospace Series Steel FE-PA18 Quenched and Cold Drawn Strip for Spring a Less Than or Equal to 4 0 mm Issue P 1《航空航天系列.钢FE-PA18卒火和冷拉带用于弹簧a小于或等于4 0mm P1板》.pdf
  • AECMA PREN 3474-2003 Aerospace Series Aluminium Alloy AL-P2024-T81 Sheet and Strip 0 25 mm Less Than or Equal to a Less Than or equal to 6 mm Issue P 3《航空航天系列.铝合金铝合金 AL-P2024-T81 板.pdf AECMA PREN 3474-2003 Aerospace Series Aluminium Alloy AL-P2024-T81 Sheet and Strip 0 25 mm Less Than or Equal to a Less Than or equal to 6 mm Issue P 3《航空航天系列.铝合金铝合金 AL-P2024-T81 板.pdf
  • AECMA PREN 3475-100-2009 Aerospace series Cables electrical aircraft use Test methods Part 100 General Edition P 4《航空航天系列.航空用电缆.测试方法.第100部分 总则.版本P4》.pdf AECMA PREN 3475-100-2009 Aerospace series Cables electrical aircraft use Test methods Part 100 General Edition P 4《航空航天系列.航空用电缆.测试方法.第100部分 总则.版本P4》.pdf
  • AECMA PREN 3475-201-1992 Aerospace Series Cables Electrical Aircraft Use Test Methods Part 201 - Visual Examination Issue P 1《航天系列 飞行器用的电缆试验方法.第201部分.表观检验》.pdf AECMA PREN 3475-201-1992 Aerospace Series Cables Electrical Aircraft Use Test Methods Part 201 - Visual Examination Issue P 1《航天系列 飞行器用的电缆试验方法.第201部分.表观检验》.pdf
  • 相关搜索

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

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