【计算机类职业资格】三级网络技术机试-250及答案解析.doc

上传人:eveningprove235 文档编号:1321953 上传时间:2019-10-17 格式:DOC 页数:4 大小:28KB
下载 相关 举报
【计算机类职业资格】三级网络技术机试-250及答案解析.doc_第1页
第1页 / 共4页
【计算机类职业资格】三级网络技术机试-250及答案解析.doc_第2页
第2页 / 共4页
【计算机类职业资格】三级网络技术机试-250及答案解析.doc_第3页
第3页 / 共4页
【计算机类职业资格】三级网络技术机试-250及答案解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、三级网络技术机试-250 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:把 s 字符串中的所有字母改成该字母的下一个字母,字母 z 改成字母 a。要求大写字母仍为大写字母,小写字母仍为小写字母,其他字符不做改变。请编写函数 chg(char*s)实现程序要求,最后调用函数 readwriteDAT(),读取 in36.dat 中的字符串,并把结果输出到文件 out36.dat 中。例如:s 字符串中原有的内容为 Mn 123Zxy,则调用该函数后,结果为 No 123Ayz。注意:部分源程序已给出。请勿改动主函数 mai

2、n()和输入输出函数 readwriteDAT()的内容。试题程序: #includestdio. h#includestring. h# includeconio, h# includectype, h#define N 81void readwriteDAT ();void chg(char as)main ( )char a N;clrscr (); printf(“Enter a string:“);gets (a);printf (“The original string is :“);puts (a);chg (a);printf(“The string after modifie

3、d :“);puts (a);readwriteDAT ();void readwriteDAT ()int i;char a N;FILE *rf, *wf;r f=fopen (“in36. dat“, “r“ );wf=fopen (“out36. dat“, “w“ );for (i=0;ifgets (a, 81, rf);chg (a);fprintf (wf, “%s“, a);fclose (rf);fclose (wf);(分数:100.00)_三级网络技术机试-250 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程

4、序的功能是:把 s 字符串中的所有字母改成该字母的下一个字母,字母 z 改成字母 a。要求大写字母仍为大写字母,小写字母仍为小写字母,其他字符不做改变。请编写函数 chg(char*s)实现程序要求,最后调用函数 readwriteDAT(),读取 in36.dat 中的字符串,并把结果输出到文件 out36.dat 中。例如:s 字符串中原有的内容为 Mn 123Zxy,则调用该函数后,结果为 No 123Ayz。注意:部分源程序已给出。请勿改动主函数 main()和输入输出函数 readwriteDAT()的内容。试题程序: #includestdio. h#includestring.

5、h# includeconio, h# includectype, h#define N 81void readwriteDAT ();void chg(char as)main ( )char a N;clrscr (); printf(“Enter a string:“);gets (a);printf (“The original string is :“);puts (a);chg (a);printf(“The string after modified :“);puts (a);readwriteDAT ();void readwriteDAT ()int i;char a N;F

6、ILE *rf, *wf;r f=fopen (“in36. dat“, “r“ );wf=fopen (“out36. dat“, “w“ );for (i=0;ifgets (a, 81, rf);chg (a);fprintf (wf, “%s“, a);fclose (rf);fclose (wf);(分数:100.00)_正确答案:(void chg(char *s)while (*s)if(*s=z | |*s=z) /*字母 z 改成字母 a,字母 z 改成字母 A*/*s-=25;s+; /*取下一个字母* /else if(*s=as+; /*取下一个字母*/else if

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

展开阅读全文
相关资源
猜你喜欢
  • SANS 1833-2-2007 Textiles - Quantitative chemical analysis Part 2 Ternary fibre mixtures《纺织品 定量化学分析 第2部分:三组分纤维混纺纤维》.pdf SANS 1833-2-2007 Textiles - Quantitative chemical analysis Part 2 Ternary fibre mixtures《纺织品 定量化学分析 第2部分:三组分纤维混纺纤维》.pdf
  • SANS 1833-21-2007 Textiles - Quantitative chemical analysis Part 21 Mixtures of chlorofibres certain modacrylics certain elastanes acetates triacetates and certain other fibres (me.pdf SANS 1833-21-2007 Textiles - Quantitative chemical analysis Part 21 Mixtures of chlorofibres certain modacrylics certain elastanes acetates triacetates and certain other fibres (me.pdf
  • SANS 1833-3-2007 Textiles - Quantitative chemical analysis Part 3 Mixtures of acetate and certain other fibres (method using acetone)《纺织品 定量化学分析 第3部分:乙酸酯和某些其它纤维的混合(用丙酮法)》.pdf SANS 1833-3-2007 Textiles - Quantitative chemical analysis Part 3 Mixtures of acetate and certain other fibres (method using acetone)《纺织品 定量化学分析 第3部分:乙酸酯和某些其它纤维的混合(用丙酮法)》.pdf
  • SANS 1833-7-2007 Textiles - Quantitative chemical analysis Part 7 Mixtures of polyamide and certain other fibres (method using formic acid)《纺织品 定量化学分析 第7部分:聚酰胺和某些其它纤维的混合(甲酸法)》.pdf SANS 1833-7-2007 Textiles - Quantitative chemical analysis Part 7 Mixtures of polyamide and certain other fibres (method using formic acid)《纺织品 定量化学分析 第7部分:聚酰胺和某些其它纤维的混合(甲酸法)》.pdf
  • SANS 1833-8-2007 Textiles - Quantitative chemical analysis Part 8 Mixtures of acetate and triacetate fibres (method using acetone)《纺织品 定量化学分析 第8部分:乙酸酯和三醋酸纤维的混合(丙酮法)》.pdf SANS 1833-8-2007 Textiles - Quantitative chemical analysis Part 8 Mixtures of acetate and triacetate fibres (method using acetone)《纺织品 定量化学分析 第8部分:乙酸酯和三醋酸纤维的混合(丙酮法)》.pdf
  • SANS 1833-9-2007 Textiles - Quantitative chemical analysis Part 9 Mixtures of acetate and triacetate fibres (method using benzyl alcohol)《纺织品 定量化学分析 第9部分:乙酸酯和三醋酸混纺纤维(苄醇法)》.pdf SANS 1833-9-2007 Textiles - Quantitative chemical analysis Part 9 Mixtures of acetate and triacetate fibres (method using benzyl alcohol)《纺织品 定量化学分析 第9部分:乙酸酯和三醋酸混纺纤维(苄醇法)》.pdf
  • SANS 1834-2005 Unsintered polytetrafluoroethylene (PTFE) tapes for engineering applications《工程用未烧结聚四氟乙烯(PTFE)胶带》.pdf SANS 1834-2005 Unsintered polytetrafluoroethylene (PTFE) tapes for engineering applications《工程用未烧结聚四氟乙烯(PTFE)胶带》.pdf
  • SANS 18415-2009 Cosmetics - Microbiology - Detection of specified and non-specified microorganisms《化妆品 微生物学 专用和非专用微生物的检测》.pdf SANS 18415-2009 Cosmetics - Microbiology - Detection of specified and non-specified microorganisms《化妆品 微生物学 专用和非专用微生物的检测》.pdf
  • SANS 1843-2005 High performance engine lubricating oil for diesel engines (for API Service Category CI-4)《柴油机的高性能发动机润滑油(用于API服务等级CI-4)》.pdf SANS 1843-2005 High performance engine lubricating oil for diesel engines (for API Service Category CI-4)《柴油机的高性能发动机润滑油(用于API服务等级CI-4)》.pdf
  • 相关搜索

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

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