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

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

1、国家三级信息管理技术机试模拟试卷 36及答案与解析 一、程序设计题 1 下列程序的功能是:把 s字符串中的所有字母改成该字母的下一个字母,字母 2改成字母 a。要求大写字母仍为大写字母,小写字母仍为小写字母,其他字符不做改变。请编写函数 chg(char*s)实现程序要求,最后调用函数 readwriteDAT(),读取in36.dat中的字符串,并把结果输出到文件 out36.dat中。 例如: s字符串中原有的内容为 Mn 123Zxy,则调用该函数后,结果为 No 123Ayz。 注意;部分源程序已 给出。 请勿改动主函数脚 main()和输入输出函数 readwriteDAT()的内容

2、 试题程序: #include stdio.h #include string.h #include conio.h #include ctype.h #define N 81 void readwriteDAT(); void chg(char *s) main() char aN; clrscr(); printf(“Enter a string:“); gets(a); printf(“The original string is :“); puts(a); chg(a); printf(“The string after modified :“); puts(a); readwrit

3、eDAT(); void readwriteDAT() int i; char aN; FILE *rf,*wf; rf=fopen(“in36.dat“,“r“); wf=fopen(“out36.dat“,“w“); for(i=0;i 10;i+) fgets(a,81,rf); chg(a); fprintf(wf,“%s“,a); fclose(rf); fclose(wf); 国家三级信息管理技术机试模拟试卷 36答案与解析 一、程序设计题 1 【正确答案】 void chg(char *s) while(*s) if(*s=z|*s=Z) /*字母 z改成字母 a, 字母 Z改成

4、字母 A*/ *s-=25; s+; /*取下一个字母 */ else if(*s a s+; /*取下一个字母 */ else if(*s =A s+; /*取下一个字母 */ else s+; /*取下一个字母 */ 【试题解析】 本题考查的知识点如下: (1) 英文字母对应的 ASCII码的排列规律。 (2) 指针的操作。 (3) 选择结构中多个条件的布尔运算 。 在 ASCH码中,大、小写字母的 ASCII码是连贯的, a z对应 97 122, A Z对应 65 90。 z的 ASCII码减去 25即得到 a的 ASCII码,对 Z同样适合。所以我们要对字符串中的字符依次进行判断,若是大 (小 )写字母,则按照 ASCII码的规律和题意要求对字符进行转换。在这里,使用指针完成对字符的依次访问,每次将指针的地址加 1直至指针为空即可。在选择结构的多个条件中,若需同时满足,则用 “与 ”运算,否则,用 “或 ”运算。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 4407-1997 Aerospace Series Bolts Normal Hexagonal Head Threaded to Head in Titanium Alloy Aluminium IVD Coated Classification 1 100 MPa (at Ambient Temperature) 425 Degr.pdf AECMA PREN 4407-1997 Aerospace Series Bolts Normal Hexagonal Head Threaded to Head in Titanium Alloy Aluminium IVD Coated Classification 1 100 MPa (at Ambient Temperature) 425 Degr.pdf
  • AECMA PREN 4408-1-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 1 General Rules Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第1部分 一般规定》.pdf AECMA PREN 4408-1-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 1 General Rules Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第1部分 一般规定》.pdf
  • AECMA PREN 4408-2-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 2 Laminated Parts Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第2部分 薄片型零件》.pdf AECMA PREN 4408-2-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 2 Laminated Parts Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第2部分 薄片型零件》.pdf
  • AECMA PREN 4408-3-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 3 Parts Including Core Materials Edition P 1《航空航天系列.技术制图 复合材料部件表.pdf AECMA PREN 4408-3-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 3 Parts Including Core Materials Edition P 1《航空航天系列.技术制图 复合材料部件表.pdf
  • AECMA PREN 4408-4-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 4 Items Obtained by Winding Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第4.pdf AECMA PREN 4408-4-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 4 Items Obtained by Winding Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第4.pdf
  • AECMA PREN 4408-5-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 5 Seams Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第5部分 无缝管材》.pdf AECMA PREN 4408-5-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 5 Seams Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第5部分 无缝管材》.pdf
  • AECMA PREN 4408-6-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 6 Preforms Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第6部分 特性》.pdf AECMA PREN 4408-6-2002 Aerospace Series Technical Drawings Representation of Parts Made of Composite Materials Part 6 Preforms Edition P 1《航空航天系列.技术制图 复合材料部件表示法.第6部分 特性》.pdf
  • AECMA PREN 4409-1998 Aerospace Series Square Bars Extruded in Aluminium and Aluminium Alloys Thickness 6 mm Less Than or Equal to a Less Than or Equal to 200 mm Dimensions Edition .pdf AECMA PREN 4409-1998 Aerospace Series Square Bars Extruded in Aluminium and Aluminium Alloys Thickness 6 mm Less Than or Equal to a Less Than or Equal to 200 mm Dimensions Edition .pdf
  • AECMA PREN 4410-1998 Aerospace Series Rectangular Bars Extruded in Aluminium and Aluminium Alloys Thickness 6 mm Less Than or Equal to a Less Than or Equal to 160 mm Dimensions Edi.pdf AECMA PREN 4410-1998 Aerospace Series Rectangular Bars Extruded in Aluminium and Aluminium Alloys Thickness 6 mm Less Than or Equal to a Less Than or Equal to 160 mm Dimensions Edi.pdf
  • 相关搜索

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

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