[计算机类试卷]计算机三级网络技术机试(上机操作)模拟试卷25及答案与解析.doc

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

1、计算机三级网络技术机试(上机操作)模拟试卷 25及答案与解析 一、程序设计题 1 文件 IN DAT中存有一篇英文文章,函数 ReadData()负责将 IN DAT中的数据读到数组 inBuf中。请编制函数 replaceChar(),该函数的功能是按照指定规则对字符进行替换。变换后的值仍存人数组 inBuf中。函数 WriteData()负责将inBuf中的数据输出到文件 OUT DAT中,并且在屏幕上输出。替换规则为:先对字符的 ASCII码值按公式 y=a*11 mod 256进行运算 (a为 某一字符的 ASCII码值, y为变换后的 ASCII码值 ),如果原字符是小写字母或计算后

2、 y的值小于等于32,则字符保持不变,否则用 y对应的字符代替。 注意:部分源程序已给出。 原始数据文件存放的格式是:每行的宽度均小于 80个字符。 请勿改动主函数 main()、读函数 ReadData()和写函数 WriteData()的内容。 试题程序: #include #include #include #include #define LINE 50 #define COL 80 char inBufLINECOL+1; int totleLine=0;文章的总行数 int ReadData(void); void WriteData(void); void replaceChar

3、) void main() system(“CLS”); if(RcadData() printf(“IN DAT cant be open! n 007”); return; replaceChar(); WriteData(); int ReadData(void) FILE*fp; int i=0; char*P; if(fp=fopen(“IN DAT” “r”)=NULL)re turn 1; while(fgets(inBufi, COL+1, fp)!=NULL) P=strchr(inBufi, n); if(p)*P= 0; i+1 totleLine=i; fclose(

4、fp); return 0; void WriteData(void) FILE*fp; int i; fp=open(“OUT DAT”, “w”); for(i=0; itotleLine; i+) print(“ s n”, inBufi); fprint(fp, “ s n”, inBufi); fclose(fp); 计算机三级网络技术机试(上机操作)模拟试卷 25答案与解析 一、程序设计题 1 【正确答案】 void replaceChar() int i, j, str; char Y; for(i=0; itotleLine; i+) 以行为单位获取字符 str=strlen(inBufi); 求当前行字符串的长度 for(j=0; jstr; j+) 依次取每行的各字符 y=inBufij*11 256; 按照指定的规则求出 y if(y=32 (inBufij=a inBut ij=z)continue; 若符合条件,不进行转换 else inBufij=y;否则进行 转换 【试题解析】 本题考查的主要是字符与其对应的 ASCII码之间的转换及时ASCII码进行操作。首先计算出每行字符串的长度,再根据替换规则进行相应的替换。

展开阅读全文
相关资源
猜你喜欢
  • ANSI ISO IEC 15041-1997 Information technology - Data interchange on 90 mm optical disk cartridges - Capacity 640 Mbytes per cartridge (Adopted by INCITS)《信息技术.90 mm光盘盒上的数据交换.容量 IN.pdf ANSI ISO IEC 15041-1997 Information technology - Data interchange on 90 mm optical disk cartridges - Capacity 640 Mbytes per cartridge (Adopted by INCITS)《信息技术.90 mm光盘盒上的数据交换.容量 IN.pdf
  • ANSI ISO IEC 15286-1999 Information technology 130 mm optical disk cartridges for information interchange Capacity 5 2 Gbytes per cartridge (Adopted by INCITS)《信息技术.用于信息交换的130mm光盘盒.pdf ANSI ISO IEC 15286-1999 Information technology 130 mm optical disk cartridges for information interchange Capacity 5 2 Gbytes per cartridge (Adopted by INCITS)《信息技术.用于信息交换的130mm光盘盒.pdf
  • ANSI ISO IEC 15292-2001 Information technology Security techniques Protection Profile registration procedures (Adopted by INCITS)《信息技术.安全技术.被IMCITS采用的保护轮廓注册程序》.pdf ANSI ISO IEC 15292-2001 Information technology Security techniques Protection Profile registration procedures (Adopted by INCITS)《信息技术.安全技术.被IMCITS采用的保护轮廓注册程序》.pdf
  • ANSI ISO IEC 15414-2002 Information technology Open distributed processing Reference model Enterprise language (Adopted by INCITS)《信息技术.开放分布式处理.参考模型.被INCITS采用的企业语言》.pdf ANSI ISO IEC 15414-2002 Information technology Open distributed processing Reference model Enterprise language (Adopted by INCITS)《信息技术.开放分布式处理.参考模型.被INCITS采用的企业语言》.pdf
  • ANSI ISO IEC 15444-1-2000 Information technology JPEG 2000 image coding system Part 1 Core coding system Adopted by INCITS Amendment 1 3 01 2002《信息技术.JPEG 2000图像编码系统.第1部分 被INCITS采用.pdf ANSI ISO IEC 15444-1-2000 Information technology JPEG 2000 image coding system Part 1 Core coding system Adopted by INCITS Amendment 1 3 01 2002《信息技术.JPEG 2000图像编码系统.第1部分 被INCITS采用.pdf
  • ANSI ISO IEC 15457-1-2001 Identification cards Thin flexible cards Part 1 Physical characteristics (Adopted by INCITS)《识别卡.薄柔性卡片.第1部分 被INCITS采用的物理特性》.pdf ANSI ISO IEC 15457-1-2001 Identification cards Thin flexible cards Part 1 Physical characteristics (Adopted by INCITS)《识别卡.薄柔性卡片.第1部分 被INCITS采用的物理特性》.pdf
  • ANSI ISO IEC 15457-3-2002 Identification cards Thin flexible cards Part 3 Test methods (Adopted by INCITS)《识别卡.薄柔性卡片.第3部分 被INCITS采用的试验方法》.pdf ANSI ISO IEC 15457-3-2002 Identification cards Thin flexible cards Part 3 Test methods (Adopted by INCITS)《识别卡.薄柔性卡片.第3部分 被INCITS采用的试验方法》.pdf
  • ANSI ISO IEC 15486-1998 Information technology - Data interchange on 130 mm optical disk cartridges of type WORM (Write Once Read Many) using irreversible effects - Capacity 2 6 Gb.pdf ANSI ISO IEC 15486-1998 Information technology - Data interchange on 130 mm optical disk cartridges of type WORM (Write Once Read Many) using irreversible effects - Capacity 2 6 Gb.pdf
  • ANSI ISO IEC 15693-1-2000 Identification cards Contactless integrated circuit(s) cards Vicinity cards Part 1 Physical characteristics (Adopted by INCITS)《识别卡.无触点集成电路卡.近距型卡.第1部分 被IN.pdf ANSI ISO IEC 15693-1-2000 Identification cards Contactless integrated circuit(s) cards Vicinity cards Part 1 Physical characteristics (Adopted by INCITS)《识别卡.无触点集成电路卡.近距型卡.第1部分 被IN.pdf
  • 相关搜索

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

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