【计算机类职业资格】全国计算机等级考试三级网络技术机试真题2006年4月及答案解析.doc

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

1、全国计算机等级考试三级网络技术机试真题 2006 年 4 月及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()用于实现从文件 ENG.IN 中读取一篇英文文章,并将其存入字符串数组 xx 中。请编制函数 encryptChar0(),按给定的替代关系对数组 xx 中所有的字符进行替代,结果仍存入字符串数组 xx 的对应位置上,最后调用函数 WriteDat()把结果艇输出到文件 PS3.DAT 中。替代关系:f(p)=p*17 mod 256(p 是数组中某一个字符的 ASC值,f(p)是计算后新字符的 ASC值)。如

2、果计算后 f(p)的值小于 32 或其 ASC值是奇数,则该字符不变,否则将 f(p)所对应的字符进行替代。原始数据文件的格式是:每行的宽度均小于 80 个字符。注意:部分源程序给出如下。请勿改动主函数 main()、读数据函数 ReadDat()和输出数据函数 WriteDat()的内容。试题源程序#includestdio.h#includestring.h#includeconio.h#includectype.hunsigned char xx5080;int maxline=0;/*文章的总行数*/int ReadDat(void);void WriteDat(void);void

3、encryptChar()void msin()system(“cls“);if(ReadDat()printf(“数据文件 ENG.IN 不能打开!/n/007“);return;encryptChar();writeDat();int ReadDat(void)FILE *fp;int i=0;unsigned char *p;if(fp=fopen(“eng.in“,“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;voi

4、d WriteDat(void)FILE *fp;int i;fp=fopen(“ps.dat“,“w“);for(i=0;imaxline;i+)printf(“%s/n“,xxi);fprintf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_全国计算机等级考试三级网络技术机试真题 2006 年 4 月答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()用于实现从文件 ENG.IN 中读取一篇英文文章,并将其存入字符串数组 xx 中。请编制函数 encryptChar0(),按给定的替代关

5、系对数组 xx 中所有的字符进行替代,结果仍存入字符串数组 xx 的对应位置上,最后调用函数 WriteDat()把结果艇输出到文件 PS3.DAT 中。替代关系:f(p)=p*17 mod 256(p 是数组中某一个字符的 ASC值,f(p)是计算后新字符的 ASC值)。如果计算后 f(p)的值小于 32 或其 ASC值是奇数,则该字符不变,否则将 f(p)所对应的字符进行替代。原始数据文件的格式是:每行的宽度均小于 80 个字符。注意:部分源程序给出如下。请勿改动主函数 main()、读数据函数 ReadDat()和输出数据函数 WriteDat()的内容。试题源程序#includestd

6、io.h#includestring.h#includeconio.h#includectype.hunsigned char xx5080;int maxline=0;/*文章的总行数*/int ReadDat(void);void WriteDat(void);void encryptChar()void msin()system(“cls“);if(ReadDat()printf(“数据文件 ENG.IN 不能打开!/n/007“);return;encryptChar();writeDat();int ReadDat(void)FILE *fp;int i=0;unsigned cha

7、r *p;if(fp=fopen(“eng.in“,“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;fp=fopen(“ps.dat“,“w“);for(i=0;imaxline;i+)printf(“%s/n“,xxi);fprintf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_正确答案:(void encryptChar(

8、)int i;char *p;for(i=0;imaxline;i+) /*遍历数组 xx 的所有行*/p=xxi; /*让字符指针指向该行的第一个字符*/while(*P!=0) if(*P*17%256)%2!=0|(*p*17%25 6)=32)/*若替换值满足替换条件*/P+;continue;*p=*p*17%256; /*将指针 p 的内容替换为计算出的值*/p+; /*移动指针 p 指向下一个字符*/)解析:解析本题主要考查的是字符替换问题。首先用 for 循环遍历每 97,对于某一行 xxi来说,先让字符指针 p 指向该行的第一个字符,然后使用 while 循环和指针 p 遍历该行的每一个字符。根据题目要求,如果遇到“p*17 mod 256”的值为奇数或者小于等于 32,字符不变(把指针指向下一个字符,结束本次循环),否则将该字符替换为“p*17 mod 256”的值,将指针指向下一个字符,进入下一次循环。

展开阅读全文
相关资源
猜你喜欢
  • SIS SS-ISO 4038-1979 Road vehicles  Hydraulic braking systems  Pipes tapped holes and male fittings《道路车辆  液压制动系统 管道、螺纹孔和外螺纹配件》.pdf SIS SS-ISO 4038-1979 Road vehicles Hydraulic braking systems Pipes tapped holes and male fittings《道路车辆 液压制动系统 管道、螺纹孔和外螺纹配件》.pdf
  • SIS SS-ISO 4038-1985 Road vehicles  Hydraulic braking systems  Pipes tapped holes male fittings and hose end fittings《道路车辆 水压制动系统 管子、螺孔、阳螺纹管接头以及软管终端配件》.pdf SIS SS-ISO 4038-1985 Road vehicles Hydraulic braking systems Pipes tapped holes male fittings and hose end fittings《道路车辆 水压制动系统 管子、螺孔、阳螺纹管接头以及软管终端配件》.pdf
  • SIS SS-ISO 4039-1979 Road vehicles  Pneumatic braking systems  Pipes tapped holes and male fittings《道路车辆 气制动系统  管道、螺纹孔和外螺纹配件》.pdf SIS SS-ISO 4039-1979 Road vehicles Pneumatic braking systems Pipes tapped holes and male fittings《道路车辆 气制动系统 管道、螺纹孔和外螺纹配件》.pdf
  • SIS SS-ISO 4040-1985 Road vehicles  Passenger cars  Loca- tion of hand controls indicators and tell-tales《道路车辆 客车 手控装置、指示器和信号装置的位置》.pdf SIS SS-ISO 4040-1985 Road vehicles Passenger cars Loca- tion of hand controls indicators and tell-tales《道路车辆 客车 手控装置、指示器和信号装置的位置》.pdf
  • SIS SS-ISO 4055-1979 Road vehicles  Caravans and light trailers  Electromagnetic braking《道路车辆 大篷车和轻型拖车 电磁制动》.pdf SIS SS-ISO 4055-1979 Road vehicles Caravans and light trailers Electromagnetic braking《道路车辆 大篷车和轻型拖车 电磁制动》.pdf
  • SIS SS-ISO 406-1989 Technical drawings  Tolerancing of linear and angular dimensions《技术图纸 线性公差和角度尺寸》.pdf SIS SS-ISO 406-1989 Technical drawings Tolerancing of linear and angular dimensions《技术图纸 线性公差和角度尺寸》.pdf
  • SIS SS-ISO 4063-1990 Welding brazing soldering and braze welding of metals  IMomenclature of processes and reference numbers for symbolic representation on drawings《金属定位焊接、钎焊、热焊接及金.pdf SIS SS-ISO 4063-1990 Welding brazing soldering and braze welding of metals IMomenclature of processes and reference numbers for symbolic representation on drawings《金属定位焊接、钎焊、热焊接及金.pdf
  • SIS SS-ISO 4064 2-1982 Measurement of water flow in closed conduits - Meters for cold potable water - Part 2 Installation require- ments《封闭管道水流测量 饮用水水表 第2部分:安装要求》.pdf SIS SS-ISO 4064 2-1982 Measurement of water flow in closed conduits - Meters for cold potable water - Part 2 Installation require- ments《封闭管道水流测量 饮用水水表 第2部分:安装要求》.pdf
  • SIS SS-ISO 4067 6-1987 Technical drawings -1 nstallations - Part 6 Graphical symbols for supply water drainage systems in the ground《技术制图 安装 第6部分:地下供水排水系统图形符号》.pdf SIS SS-ISO 4067 6-1987 Technical drawings -1 nstallations - Part 6 Graphical symbols for supply water drainage systems in the ground《技术制图 安装 第6部分:地下供水排水系统图形符号》.pdf
  • 相关搜索

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

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