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

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

1、国家三级(网络技术)机试模拟试卷 266及答案与解析 一、程序设计题 1 请编制函数 int findValue(int outBuf),其功能是;在三位整数 (100 999)中寻找符合下面条件的整数,并依次从小到大存人数组 b中;它既是完全平方数,又有两位数字相同,例如 144, 676等。 满足该条件的整数的个数通过所编制的函数返回。 最后调用函数 WriteData(int num, int b)把结果输出到文件 OUT DAT中。 注意;部分源程序已给出。 请勿改动主函数 main()和写函数 WriteData()的内容。 试题程序; #include void WriteData

2、int, int b); int findValue(int outBuf) void main() int b20, hum; num=findValue(b); WriteData(hum, b); void WriteData(int num, int b) FILE*out; int i; out=fopen(“OUT DAT“, “w“); printf(“num= d n“, num); fprintflout, “num= d n“, num); for(i=0; ihum; i+) printf(“b d= dn“, i, bi); fprintf(out, “b d= d

3、n“, i, bi); fclose(out); 国家三级(网络技术)机试模拟试卷 266答案与解析 一、程序设计题 1 【正确答案】 int findValue(int outBuf) int i, dl, d2, d3, count=0; for(i=10; i*i1000; i+) dl=i*i 100; 求该平方数的百位数字 d2=i*i 10 10; 求该平方数的十位数字 d3=i*i 10; 求该平方数的个位数字 if(d1=d2|d2=d3|d3=d1) outBufcount+=i*i; return count; 【试题解析】 本题主要考查数位分解及排 序。基本思路是;由于最小的三位数100是 10的平方,因此可以从 10开始,判断每个数的平方值是否有两位数字相同,直到找到数的平方值大于 999,这样既可遍历 100 999中所有的平方数,循环中将满足条件的数存入数组 outBuf中,由于遍历是从小到大的,因此数组outBuf中的元素已经按升序排列。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 6029-1998 Aerospace Series Rod-Ends Adjustable Single Fork with UNJ Threaded Shank Min Engagement 1 5 x Thread Diameter in Corrosion Resisting Steel Dimensions and Loads.pdf AECMA PREN 6029-1998 Aerospace Series Rod-Ends Adjustable Single Fork with UNJ Threaded Shank Min Engagement 1 5 x Thread Diameter in Corrosion Resisting Steel Dimensions and Loads.pdf
  • AECMA PREN 6030-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of the Mechanical Degradation Due to Chemical Paint Strippers Edition P1《航空航天系列.纤维加固塑料试验方法.pdf AECMA PREN 6030-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of the Mechanical Degradation Due to Chemical Paint Strippers Edition P1《航空航天系列.纤维加固塑料试验方法.pdf
  • AECMA PREN 6031-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of in-Plane Shear Properties (+ - 45 Degree Tensile Test) Edition P1《航空航天系列.纤维加固塑料试验方法飞机内修.pdf AECMA PREN 6031-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of in-Plane Shear Properties (+ - 45 Degree Tensile Test) Edition P1《航空航天系列.纤维加固塑料试验方法飞机内修.pdf
  • AECMA PREN 6032-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of the Glass Transition Temperatures Edition P1《航空航天系列.纤维加固塑料试验方法玻璃转换温度.P1版》.pdf AECMA PREN 6032-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of the Glass Transition Temperatures Edition P1《航空航天系列.纤维加固塑料试验方法玻璃转换温度.P1版》.pdf
  • AECMA PREN 6033-1995 Aerospace Series Carbon Fibre Reinforced Plastics Test Method Determination of Interlaminar Fracture Toughness Energy Mode I - GIc Edition P1《航空航天系列.纤维加固塑料试验方法.pdf AECMA PREN 6033-1995 Aerospace Series Carbon Fibre Reinforced Plastics Test Method Determination of Interlaminar Fracture Toughness Energy Mode I - GIc Edition P1《航空航天系列.纤维加固塑料试验方法.pdf
  • AECMA PREN 6034-1995 Aerospace Series Carbon Fibre Reinforced Plastics Test Method Determination of Interlaminar Fracture Toughness Energy Mode II - GIIc Edition P1《航空航天系列.纤维加固塑料试验.pdf AECMA PREN 6034-1995 Aerospace Series Carbon Fibre Reinforced Plastics Test Method Determination of Interlaminar Fracture Toughness Energy Mode II - GIIc Edition P1《航空航天系列.纤维加固塑料试验.pdf
  • AECMA PREN 6035-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of Notched and Unnotched Tensile Strength Edition P1《航空航天系列.纤维加固塑料试验方法凹陷和非凹陷拉伸强度.P1版》.pdf AECMA PREN 6035-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of Notched and Unnotched Tensile Strength Edition P1《航空航天系列.纤维加固塑料试验方法凹陷和非凹陷拉伸强度.P1版》.pdf
  • AECMA PREN 6036-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of Notched Unnotched and Filled Hole Compression Strength Edition P1《航空航天系列.纤维加固塑料试验方法凹陷和非.pdf AECMA PREN 6036-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of Notched Unnotched and Filled Hole Compression Strength Edition P1《航空航天系列.纤维加固塑料试验方法凹陷和非.pdf
  • AECMA PREN 6037-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of Bearing Strength Edition P1《航空航天系列.纤维加固塑料试验方法轴承强度.P1版》.pdf AECMA PREN 6037-1995 Aerospace Series Fibre Reinforced Plastics Test Method Determination of Bearing Strength Edition P1《航空航天系列.纤维加固塑料试验方法轴承强度.P1版》.pdf
  • 相关搜索

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

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