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

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

1、三级网络技术机试-269 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是实现从文件 ENG18.IN 中读取一篇英文文章,存入到字符串数组 xx 中;请编制函数 encryptChar(),按给定的替代关系对数组 xx 中的所有字符进行替代,结果仍存入数组 xx 的对应的位置上,最后调用函数 WriteDat()把结果 xx 输出到文件 PS18.DAT 中。替代关系:f(p)=p*11 mod 256(p 是数组 xx 中某一个字符的 ASCII 值,f(p)是计算后新字符的 ASCII 值),如果计算后

2、 f(p)的值小于等于 32 或 f(p)对应的字符是数字 0 至 9,则该字符不变,否则将 f(p)所对应的字符进行替代。注意:部分源程序已给出。原始数据文件存放的格式是:每行的宽度均小于 80 个字符。请勿改动主函数 main()、读函数 ReadDat()和写函数 WriteDat()的内容。试题程序:#includeconio.h#includectype.hunsigned char xx50 80;int maxline = 0; /* 文章的总行数 */int ReadDat (void);void WriteDat(void);void encryptChar()main (

3、)clrscr ( );if (ReadDat ()printf(“数据文件 ENS18.IN 不能打开! /n/007“);return;encryptChar ();WriteDat ();int ReadDat (void)FILE *fp;int i=0;unsigned char *p;if(fp = fopen(“ENG18.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 (“PS18.DAT“, “w“);for(i = 0; imaxline; i+)printf(“%s/n“, xxi );fprintf(fp, “%s/n“, xxi);fclose (fp);(分数:100.00)_三级网络技术机试-269 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是实现从文件 ENG18.IN 中读取一篇英文文章,存入到字符串数组 xx 中;请编制函数 encryptChar(),按给定的替代关系

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

6、内容。试题程序:#includeconio.h#includectype.hunsigned char xx50 80;int maxline = 0; /* 文章的总行数 */int ReadDat (void);void WriteDat(void);void encryptChar()main ( )clrscr ( );if (ReadDat ()printf(“数据文件 ENS18.IN 不能打开! /n/007“);return;encryptChar ();WriteDat ();int ReadDat (void)FILE *fp;int i=0;unsigned char *

7、p;if(fp = fopen(“ENG18.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 (“PS18.DAT“, “w“);for(i = 0; imaxline; i+)printf(“%s/n“, xxi );fprintf(fp, “%s/n“, xxi);fclose (fp);(分数:1

8、00.00)_正确答案:(void encryptChar()int i;char *pf;for (i=0; imaxline; i+)pf=xx i;while (*pf !=0)if(*pf*11%256=0 /*如果计算后的值小于等于 32 或 f(p)对应的字符是数字 0 至 9,则该字符不变*/ *pf=*pf*11%256; /*否则按给定的替代关系进行替代*/pf+;)解析:解析 本题主要考查用指针变量来控制字符数组,由于要对已有二维字符数组的所有元素逐个处理,因此,需要定义一个字符指针变量来控制原二维数组的各行,当前行如果确定下来,用指针的移动就可以依次扫描该行的所有字符元素,每得到一个字符就对它行条件判断,根据题意,条件用“if(*pf*11%256=0 & *pf*11%256=9)|*pf*11%256=32)”语句来实现,如果该字符不满足上述条件,就用一个新的字符来替代,新的字符是当前字符乘以 11 的结果再去与 256 求余数。处理完毕后,指针去取下一个字符。如果该字符满足所给条件,将不做任何操作,指针直接下移,去取下一个字符,对下一个字符进行处理。

展开阅读全文
相关资源
猜你喜欢
  • ITU-T H 235 5-2005 H 323 security Framework for secure authentication in RAS using weak shared secrets (Study Group 16)《H 323安全框架 在远程访问服务(RAS)中使用弱共享机密的安全认证框架 16号研究组》.pdf ITU-T H 235 5-2005 H 323 security Framework for secure authentication in RAS using weak shared secrets (Study Group 16)《H 323安全框架 在远程访问服务(RAS)中使用弱共享机密的安全认证框架 16号研究组》.pdf
  • ITU-T H 235 6-2014 H 323 security Encryption profile with native ITU-T H 235 H 245 key management (Study Group 16)《H 323安全 本地国际电信联盟-电信标准局 h 235 h 245密钥管理加密文件(研究组16)》.pdf ITU-T H 235 6-2014 H 323 security Encryption profile with native ITU-T H 235 H 245 key management (Study Group 16)《H 323安全 本地国际电信联盟-电信标准局 h 235 h 245密钥管理加密文件(研究组16)》.pdf
  • ITU-T H 235 7 FRENCH-2005 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(SRTP)使用.pdf ITU-T H 235 7 FRENCH-2005 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(SRTP)使用.pdf
  • ITU-T H 235 7 NOTE FRENCH-2006 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(SR.pdf ITU-T H 235 7 NOTE FRENCH-2006 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(SR.pdf
  • ITU-T H 235 7 NOTE SPANISH-2006 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(S.pdf ITU-T H 235 7 NOTE SPANISH-2006 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(S.pdf
  • ITU-T H 235 7 NOTE-2006 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323 安全框架 为H 235中安全实时传送协议(SRTP)使用.pdf ITU-T H 235 7 NOTE-2006 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323 安全框架 为H 235中安全实时传送协议(SRTP)使用.pdf
  • ITU-T H 235 7 SPANISH-2005 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(SRTP)使.pdf ITU-T H 235 7 SPANISH-2005 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235《H 323安全框架 H 235中安全实时传输协议(SRTP)使.pdf
  • ITU-T H 235 7-2005 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235 (Study Group 16)《H 323 安全框架 为H 235中安全实时.pdf ITU-T H 235 7-2005 H 323 security Usage of the MIKEY key management protocol for the Secure Real Time Transport Protocol (SRTP) within H 235 (Study Group 16)《H 323 安全框架 为H 235中安全实时.pdf
  • ITU-T H 235 8 FRENCH-2005 H 323 security Key exchange for SRTP using secure signalling channels《H 323安全框架 使用安全信道的安全实时传输协议(SRTP)密钥交换 16号研究组》.pdf ITU-T H 235 8 FRENCH-2005 H 323 security Key exchange for SRTP using secure signalling channels《H 323安全框架 使用安全信道的安全实时传输协议(SRTP)密钥交换 16号研究组》.pdf
  • 相关搜索

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

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