[计算机类试卷]国家三级(网络技术)机试模拟试卷32及答案与解析.doc

上传人:inwarn120 文档编号:495855 上传时间:2018-11-28 格式:DOC 页数:4 大小:29KB
下载 相关 举报
[计算机类试卷]国家三级(网络技术)机试模拟试卷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(),该函数的功能是:以行为单位把字符串中所有小写字母。左边的字符串内容移至该串的右边 存放,然后把小写字母。删除,余下的字符串内容移到已处理字符串的左边存放,最后把已处理的字符串仍按行重新存入字符串数组 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=0; int ReadDat (void); v

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

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

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

展开阅读全文
相关资源
猜你喜欢
  • BS PD ISO TR 4191-2014 Plastics piping systems for water supply Unplasticized poly(vinyl chloride)(PVC-U) and oriented PVC-U (PVC-O) Guidance for installation《供水用塑料管系统 未增塑聚氯乙烯(PVC-U)和定向PVC-U (PVC-.pdf BS PD ISO TR 4191-2014 Plastics piping systems for water supply Unplasticized poly(vinyl chloride)(PVC-U) and oriented PVC-U (PVC-O) Guidance for installation《供水用塑料管系统 未增塑聚氯乙烯(PVC-U)和定向PVC-U (PVC-.pdf
  • BS PD ISO TS 13399-305-2017 Cutting tool data representation and exchange Creation and exchange of 3D models Modular tooling systems with adjustable cartridges for boring《切削工具数据表示和交换 三维模型的创造和交流.pdf BS PD ISO TS 13399-305-2017 Cutting tool data representation and exchange Creation and exchange of 3D models Modular tooling systems with adjustable cartridges for boring《切削工具数据表示和交换 三维模型的创造和交流.pdf
  • BS PD ISO TS 19337-2016 Nanotechnologies Characteristics of working suspensions of nano-objects for $ii$in $iv$ii$it$ir$io assays to evaluate inherent nano-object toxi city《纳米技术 评估纳米物体固有毒性的体外试验所.pdf BS PD ISO TS 19337-2016 Nanotechnologies Characteristics of working suspensions of nano-objects for $ii$in $iv$ii$it$ir$io assays to evaluate inherent nano-object toxi city《纳米技术 评估纳米物体固有毒性的体外试验所.pdf
  • BS PD ISO TS 21219-2-2014 Intelligent transport systems Traffic and travel information (TTI) via transport protocol experts group generation 2 (TPEG2) UML modelling rules《智能运输系统 利用第二代传输协议专家组 (TPEG.pdf BS PD ISO TS 21219-2-2014 Intelligent transport systems Traffic and travel information (TTI) via transport protocol experts group generation 2 (TPEG2) UML modelling rules《智能运输系统 利用第二代传输协议专家组 (TPEG.pdf
  • BS PD ISO TS 28560-4-2014 Information and documentation RFID in libraries Encoding of data elements based on rules from ISO IEC 15962 in an RFID tag with partitioned memory《信息与文献 图书馆中应用的无线射频识别技术.pdf BS PD ISO TS 28560-4-2014 Information and documentation RFID in libraries Encoding of data elements based on rules from ISO IEC 15962 in an RFID tag with partitioned memory《信息与文献 图书馆中应用的无线射频识别技术.pdf
  • BS S 150-1975 Specification for chromium-molybdenum-vanadium-niobium heat-resisting steel billets bars forgings and parts (930-1080 MPa) (Cr 10 5 Mo 0 6 V 0 2 Nb 0 3)《铬-钼-钒-铌-耐热钢坯、棒材、锻件及零件规范(930-.pdf BS S 150-1975 Specification for chromium-molybdenum-vanadium-niobium heat-resisting steel billets bars forgings and parts (930-1080 MPa) (Cr 10 5 Mo 0 6 V 0 2 Nb 0 3)《铬-钼-钒-铌-耐热钢坯、棒材、锻件及零件规范(930-.pdf
  • BS PD ISO IEC TR 20000-12-2016 Information technology Service management Guidance on the relationship between ISO IEC 20000-1 2011 and service management frameworks CMMI-SVC 《信息技术 .pdf BS PD ISO IEC TR 20000-12-2016 Information technology Service management Guidance on the relationship between ISO IEC 20000-1 2011 and service management frameworks CMMI-SVC 《信息技术 .pdf
  • BS PD ISO IEC TR 20007-2014 Information technology Cultural and linguistic interoperability Definitions and relationship between symbols icons animated icons pictograms characters .pdf BS PD ISO IEC TR 20007-2014 Information technology Cultural and linguistic interoperability Definitions and relationship between symbols icons animated icons pictograms characters .pdf
  • BS PD ISO IEC TR 29110-5-1-3-2017 Systems and software engineering Lifecycle profiles for Very Small Entities (VSEs) Software engineering Management and engineering guide Generic p.pdf BS PD ISO IEC TR 29110-5-1-3-2017 Systems and software engineering Lifecycle profiles for Very Small Entities (VSEs) Software engineering Management and engineering guide Generic p.pdf
  • 相关搜索

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

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