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

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

1、国家三级信息管理技术机试模拟试卷 32及答案与解析 一、程序设计题 1 函数 ReadDat()的功能是实现从文件 IN32.DAT中读取一篇英文文章存入到字符串数组 xx中。请编制函数 StrOR(),该函数的功能是:以行为单位把字符串中所有小写字母。左边的字符串内容移至该串的右边存放,然后把小写字母 o删除,余下的字符串内容移到已处理字符串的左边存放,最后把已处理的字符串仍按行重新存入字符串数组 xx中。最后调用函数 WriteDat()把结果输出到文件 OUT32。 DAT中。 例如,原文: You can create an index on any field you have th

2、e correct record 结果: n any field Yu can create an index rd yu have the crrect rec 原始数据文件存放的格式是;每行的宽度均小于 80个字符,含标点符号和空格。 注意:部分源程序已给出。 请勿改动主函数 main()、读函数 ReadDat()和写函数, WriteDat()的内容。 试题程序: #include stdio.h #include string.h #include conio.h char xx50 80; int maxline=O; int ReadDat(void); void WriteDa

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

4、p); return 0; void WriteDat(void) FILE *fp; int i; clrscr(); fp=fopen(“OUT32.DAT“,“w“); for (i=0;i maxline;i+) printf(“%sn“,xxi); fprintf fp,“%sn“,xxi); fclose(fp) 国家三级信息管理技术机试模拟试卷 32答案与解析 一、程序设计题 1 【正确答案】 void StrOR(void) int I, j, k, index, str1; char ch; for(I=0; I maxline; I+) str1=strlen(xxI);

5、/*求各行的长度 */ index=str1; for(j=0;j str1;j+) /*将一行中所以小写字母 o右边的字符依次向左移一位,并删除字母 o*/ if (xxIj=o) for(k=j;k strl-1;k+) xxIk=xxIk+1; xxI strl-1= ; index= j; /*记录下最后一个 o所在的位置 */ for(j=str1-1;j =index;j-) /*最后一个 o右侧的所有字符都移到已处理字符串的左边 */ ch=xxI strl-1; for (k=str1-1;k O;k-) xxI k=xxI k-1; xxI0=ch; 【试题解析】 本题考查的知识点如下: (1) 循环结构与选择结构的嵌套使用。 (2) 字符数组中的元素的移动。 (3) 字符串处理函数的使用。 在本题中,以行作为字符串处理的基本单位。首先,要确定该行字符串的长度。然后使用循环结构依次对字符进行处理。先找到 字符 o,将 o右侧的字符依次向左移。这个操作同时能够删除字符 o。记录下最后一个 o所在的位置,在这个 o右侧的所有字符都要移到已处理字符串的左边,这个过程也是使用循环来完成的。最后,对文章中的每一行都进行这一操作即可。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 3273-1989 Aerospace Series Pipe Coupling 8 Degress 30' Dynamic Beam Seal End for Elbows Tees and Crosses Geometric Configuration Issue P 1《航空航天系列.导管接头8°30′钛合金动态密封带奶嘴肘和棒锻.pdf AECMA PREN 3273-1989 Aerospace Series Pipe Coupling 8 Degress 30' Dynamic Beam Seal End for Elbows Tees and Crosses Geometric Configuration Issue P 1《航空航天系列.导管接头8°30′钛合金动态密封带奶嘴肘和棒锻.pdf
  • AECMA PREN 3274-1989 Aerospace Series Pipe Coupling 8 Degrees 30' Thread End Geometric Configuration Issue P 1《航空航天系列.导管接头8°30′终螺纹几何图形.P1版》.pdf AECMA PREN 3274-1989 Aerospace Series Pipe Coupling 8 Degrees 30' Thread End Geometric Configuration Issue P 1《航空航天系列.导管接头8°30′终螺纹几何图形.P1版》.pdf
  • AECMA PREN 3275-1993 (CANCELLED) Aerospace Series Pipe Coupling 8 Degrees 30' Dynamic Beam Seal up to 28 000 kPa Metric Series Technical Specification Edition P 1《航空航天系列.导管接头8°30′钛.pdf AECMA PREN 3275-1993 (CANCELLED) Aerospace Series Pipe Coupling 8 Degrees 30' Dynamic Beam Seal up to 28 000 kPa Metric Series Technical Specification Edition P 1《航空航天系列.导管接头8°30′钛.pdf
  • AECMA PREN 3276-1988 Aerospace Series Clamps Loop ( P  Type) without Rubber Cushioning in Corrosion Resisting Steel Dimensions - Masses Edition 1《航空航天系列.无橡胶缓冲器防腐蚀钢尺寸--质量.第1版》.pdf AECMA PREN 3276-1988 Aerospace Series Clamps Loop ( P Type) without Rubber Cushioning in Corrosion Resisting Steel Dimensions - Masses Edition 1《航空航天系列.无橡胶缓冲器防腐蚀钢尺寸--质量.第1版》.pdf
  • AECMA PREN 3278-1988 Aerospace Series Sleeves Tubular Protruding Head in Corrosion Resisting Steel Passivated (0 25 mm Wall Thickness) Issue P 1《航空航天系列.管状突出袖防腐蚀钢钝化(0 25 mm 墙厚度)》.pdf AECMA PREN 3278-1988 Aerospace Series Sleeves Tubular Protruding Head in Corrosion Resisting Steel Passivated (0 25 mm Wall Thickness) Issue P 1《航空航天系列.管状突出袖防腐蚀钢钝化(0 25 mm 墙厚度)》.pdf
  • AECMA PREN 3280-1989 Aerospace Series Bearings Airframe Rolling Rigid or Self-Aligning Technical Specification Issue P 1《航空航天系列.机身旋转轴承自动找平.P1版》.pdf AECMA PREN 3280-1989 Aerospace Series Bearings Airframe Rolling Rigid or Self-Aligning Technical Specification Issue P 1《航空航天系列.机身旋转轴承自动找平.P1版》.pdf
  • AECMA PREN 3281-1987 Aerospace Series Bearings-Airframe Rolling Rigid Single Row Ball Bearings in Steel Diameter Series 8 and 9 Dimensions Torques Clearances and Loads Issue P 1《航空.pdf AECMA PREN 3281-1987 Aerospace Series Bearings-Airframe Rolling Rigid Single Row Ball Bearings in Steel Diameter Series 8 and 9 Dimensions Torques Clearances and Loads Issue P 1《航空.pdf
  • AECMA PREN 3282-1987 Aerospace Series Bearings-Airframe Rolling Rigid Single Row Ball Bearings in Steel Cadmium Plated Diameter Series 8 and 9 Dimensions Torques Clearances and Loa.pdf AECMA PREN 3282-1987 Aerospace Series Bearings-Airframe Rolling Rigid Single Row Ball Bearings in Steel Cadmium Plated Diameter Series 8 and 9 Dimensions Torques Clearances and Loa.pdf
  • AECMA PREN 3283-1987 Aerospace Series Bearings-Airframe Rolling Rigid Single Row Ball Bearings in Corrosion Resisting Steel Diameter Series 8 and 9 Dimensions Torques Clearances an.pdf AECMA PREN 3283-1987 Aerospace Series Bearings-Airframe Rolling Rigid Single Row Ball Bearings in Corrosion Resisting Steel Diameter Series 8 and 9 Dimensions Torques Clearances an.pdf
  • 相关搜索

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

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