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

上传人:吴艺期 文档编号:495651 上传时间:2018-11-28 格式:DOC 页数:6 大小:131KB
下载 相关 举报
[计算机类试卷]国家三级(网络技术)机试模拟试卷146及答案与解析.doc_第1页
第1页 / 共6页
[计算机类试卷]国家三级(网络技术)机试模拟试卷146及答案与解析.doc_第2页
第2页 / 共6页
[计算机类试卷]国家三级(网络技术)机试模拟试卷146及答案与解析.doc_第3页
第3页 / 共6页
[计算机类试卷]国家三级(网络技术)机试模拟试卷146及答案与解析.doc_第4页
第4页 / 共6页
[计算机类试卷]国家三级(网络技术)机试模拟试卷146及答案与解析.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、国家三级(网络技术)机试模拟试卷 146及答案与解析 一、程序设计题 1 国家三级(网络技术)机试模拟试卷 146答案与解析 一、程序设计题 1 【正确答案】 【试题解析】 定义字符局部变量 ch,整型循环变量 i、 j、 k和表示字符串长度的变量 len、 p。 在第一层 for循环中,变量 i从 0开始,依次递增直到其值等于 20,在循环体中,首先调用库函数 strlen(xxi)求得字符串 xXi的长度,把此值转化成整型赋给变量 len,用 len的值除以 2,得到字符串 xxi的长度的一 半赋给变量 p;在第二层 for循环中,变量 j从 0开始,依次递增直到其值等于 (p-1),在循

2、环体中执行第三层 for循环,循环变量 k从 j+1开始,依次递增直到其值等于 p,对字符串 xxi左半部分的子字符串中的字符 xxij和 xxik按照 ASCII码值的大小进行比较,如果 xxij的 ASCII码值小于 xxik的 ASCII码值,则两者进行互换,实现对字符串 xxi左半部分的子字符串按照降序排列。然后,有 if条件语句判断, len对2的余数是否等于 1,如果等于 1,说明字符串 xxi的长度为奇数,则变量 p加1,因为这时字符串的中间字符不参与排序。再对字符串 xxij右半部分的字符串按升序排列。在 for循环中,变量 j从 p开始,依次递增直到其值等于 len-1,在循环体中,执行 for循环中,变量 k从 j+1开始,依次递增直到其值等于 len,对字符 xxij和 xxik按其 ASCII码值的大小进行比较,如果字符 xxij的ASCII码值大于 xxik的 ASCII码值,则两者进行互换,实现字符串 xxi右半部分的字符串按照升序排列。

展开阅读全文
相关资源
猜你喜欢
  • STAS SR ISO 1187-1996 Special wrought copper alloys Chemical composition and forms of wrought products《特殊锻造铜合金.化学成分和锻造产品的各种形式》.pdf STAS SR ISO 1187-1996 Special wrought copper alloys Chemical composition and forms of wrought products《特殊锻造铜合金.化学成分和锻造产品的各种形式》.pdf
  • STAS SR ISO 1190 1-1993 Cooper and cooper alloys - Code of designation - Part 1  Designntinn of materials《铜与铜合金.代码的指定.第1部分: 材料的指定》.pdf STAS SR ISO 1190 1-1993 Cooper and cooper alloys - Code of designation - Part 1 Designntinn of materials《铜与铜合金.代码的指定.第1部分: 材料的指定》.pdf
  • STAS SR ISO 1190 2-1993 Copper and copper alloys Code of designation Part 2  Designation of tempers《铜及其合金.标志代码.第2部分:回火标识》.pdf STAS SR ISO 1190 2-1993 Copper and copper alloys Code of designation Part 2 Designation of tempers《铜及其合金.标志代码.第2部分:回火标识》.pdf
  • STAS SR ISO 1204-1990 Reciprocating internai combustion engines - Designation of the direction of rotation and of cylinders and valves in cylinder heads and definition of right-hana.pdf STAS SR ISO 1204-1990 Reciprocating internai combustion engines - Designation of the direction of rotation and of cylinders and valves in cylinder heads and definition of right-hana.pdf
  • STAS SR ISO 1210-1993 Plastics Determination of flammability characteristics of plastics in the form of small specimens in contact with a small flame《塑料.与小火焰相接触的小试样硬质塑料易燃特性的测定》.pdf STAS SR ISO 1210-1993 Plastics Determination of flammability characteristics of plastics in the form of small specimens in contact with a small flame《塑料.与小火焰相接触的小试样硬质塑料易燃特性的测定》.pdf
  • STAS SR ISO 1213-1-1995 Solid mineral fuels Vocabulary Part 1  Terms relating to coal preparation《固体矿物燃料.词汇.第1部分:煤制备有关的术语》.pdf STAS SR ISO 1213-1-1995 Solid mineral fuels Vocabulary Part 1 Terms relating to coal preparation《固体矿物燃料.词汇.第1部分:煤制备有关的术语》.pdf
  • STAS SR ISO 1213-2-1995 Solid mineral fuels - Vocabulary - Part 2  Terms relating to sampling testing and analysys《固体矿物燃料.词汇.第2部分:有关抽样,测试和分析的术语 》.pdf STAS SR ISO 1213-2-1995 Solid mineral fuels - Vocabulary - Part 2 Terms relating to sampling testing and analysys《固体矿物燃料.词汇.第2部分:有关抽样,测试和分析的术语 》.pdf
  • STAS SR ISO 1226-1992 Symbolic designation of direction of closing and faces of doors windows and shutters《门,窗和百叶窗的关闭与朝向方向的标记指定 》.pdf STAS SR ISO 1226-1992 Symbolic designation of direction of closing and faces of doors windows and shutters《门,窗和百叶窗的关闭与朝向方向的标记指定 》.pdf
  • STAS SR ISO 1232-1995 Aluminium oxide primarily used for the production of aluminium -Determination of silica content - Reduced molybdosilicate spectrophotometric method《主要用于生产铝的氧化.pdf STAS SR ISO 1232-1995 Aluminium oxide primarily used for the production of aluminium -Determination of silica content - Reduced molybdosilicate spectrophotometric method《主要用于生产铝的氧化.pdf
  • 相关搜索

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

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