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

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

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

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

3、N7.DAT不能打开 n007“); return; CovertCharD(); WriteDat(); int ReadDat() FILE *fp; int i=0; char *p; if (fp=fopen(“IN73.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) FILE;fp; int i: clrscr(); fp=fopen(“O

4、UT73.DAT“, “N“); for(i=0; i maxline; i+) printf(“%sn“, xxi); fprintf(fp, ”%sn“, xxi); fclose (fp); 国家三级(网络技术)机试模拟试卷 73答案与解析 一、程序设计题 1 【正确答案】 void CovertCharD() iht i; char *pf; for (i=0; i maxline; i+) pf=xx i; /*指针 pf指向各行的首地址 */ while (*pf) if(*pf=a) /*如果是字母 a,则改成字母 z*/ *pf=z; pf+; /*指向下一个字符 */ else if(*pf =b pf+; /*指向下一个字符 */ else pf+; /*如果不满足条件,则不变字符,指向下一个字符 */ 【试题解析】 本题考查的知识点如下: (1)字符串的计算。 (2)循环结构的使用。 (3)使用指针实现对数组的访问。 本题中,将字符存放在二维数组中,以行为字符处理的基本单位,可以定义一个指针,指向每一行字符。初始时,指针指向每一行的第一个元素,增加指针地址就可以实现对一行数据的完全访问。要将所有小写字母改成它的前一个字母,小写字母的 ASC 码是连续的,可直接将其 ASC 码减 1,则得要求的字符。注意;字母 a要单独处理,其他字符保持不变。

展开阅读全文
相关资源
猜你喜欢
  • STAS SR EN 10016-1-1995 Non-alloy steel rod for drawing and or cold rolling Part 1  General requirements《拉制和 或冷轧用的非合金钢棒.第1部分:一般要求》.pdf STAS SR EN 10016-1-1995 Non-alloy steel rod for drawing and or cold rolling Part 1 General requirements《拉制和 或冷轧用的非合金钢棒.第1部分:一般要求》.pdf
  • STAS SR EN 10016-2-1995 Non-alloy steel rod for drawing and or cold rolling Part 2  Specific requirements for general purposes rod《拉制和 或冷轧的非合金钢条.第2部分:一般用途棒的特殊要求》.pdf STAS SR EN 10016-2-1995 Non-alloy steel rod for drawing and or cold rolling Part 2 Specific requirements for general purposes rod《拉制和 或冷轧的非合金钢条.第2部分:一般用途棒的特殊要求》.pdf
  • STAS SR EN 10016-4-1995 Non-alloy steel rod for drawing and or cold rolling Part 4  Specific requirements for rod for special applications《拉制和 或冷轧的非合金钢条.第4部分:特殊应用棒的具体要求》.pdf STAS SR EN 10016-4-1995 Non-alloy steel rod for drawing and or cold rolling Part 4 Specific requirements for rod for special applications《拉制和 或冷轧的非合金钢条.第4部分:特殊应用棒的具体要求》.pdf
  • STAS SR EN 10020-1993 Definition and classification of grades of steel《钢等级的定义和分类 》.pdf STAS SR EN 10020-1993 Definition and classification of grades of steel《钢等级的定义和分类 》.pdf
  • STAS SR EN 10021-1995 General technical delivery requirements for steel and iron products《钢铁制品一般技术交付要求 》.pdf STAS SR EN 10021-1995 General technical delivery requirements for steel and iron products《钢铁制品一般技术交付要求 》.pdf
  • STAS SR EN 10025+A1-1994 Hot rolled products of non-alloy structural steel - Technical delivery conditions《非合金结构钢热轧产品.技术交付条件 》.pdf STAS SR EN 10025+A1-1994 Hot rolled products of non-alloy structural steel - Technical delivery conditions《非合金结构钢热轧产品.技术交付条件 》.pdf
  • STAS SR EN 10027-1-1996 Designation systems for steel - Part 1 Steel names principal symbols《钢的标志系统.第1部分:钢名称,主要符号》.pdf STAS SR EN 10027-1-1996 Designation systems for steel - Part 1 Steel names principal symbols《钢的标志系统.第1部分:钢名称,主要符号》.pdf
  • STAS SR EN 10027-2-1996 Designation systems for steel - Part 2  Numerical system《钢的标志系统.第2部分:数控系统》.pdf STAS SR EN 10027-2-1996 Designation systems for steel - Part 2 Numerical system《钢的标志系统.第2部分:数控系统》.pdf
  • STAS SR EN 10029-1995 Hot rolled steel plates 3 mm thick or above-Tolerances on dimensions shape and mass《3毫米厚或以上的热轧钢板,尺寸、形状和质量公差 》.pdf STAS SR EN 10029-1995 Hot rolled steel plates 3 mm thick or above-Tolerances on dimensions shape and mass《3毫米厚或以上的热轧钢板,尺寸、形状和质量公差 》.pdf
  • 相关搜索

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

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