【计算机类职业资格】三级数据库技术机试-221及答案解析.doc

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

1、三级数据库技术机试-221 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制函数 int findValue(int outBuf),其功能是:在 3 位整数(100999)中寻找符合下面条件的整数,并依次从小到大存入数组 b 中;它既是完全平方数,又有两位数字相同,例如 144,676 等。满足该条件的整数的个数通过所编制的函数返回。最后调用函数 WriteData()把结果输出到文件 OUT.DAT 中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 WriteData()的内容。试题程序:#includestdio

2、hvoid writeData(int,int b);int findValue(int outBuf)void main()int b20,num;num=findValue(b);writeData(num,b);void writeData(int num,int b)FILE*OUt:int i;out=fopen(OUT.DAT“,“w“);printf(“num=%d/n“,num);fprintf(out,“num=%d/n“,num);for(i=0;inum;i+)printf(“b%d=%d/n“,i,bi);fprintf(out,“b%d=%d/n“,i,bi);fc

3、lose(out);(分数:100.00)_三级数据库技术机试-221 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制函数 int findValue(int outBuf),其功能是:在 3 位整数(100999)中寻找符合下面条件的整数,并依次从小到大存入数组 b 中;它既是完全平方数,又有两位数字相同,例如 144,676 等。满足该条件的整数的个数通过所编制的函数返回。最后调用函数 WriteData()把结果输出到文件 OUT.DAT 中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 WriteData()的

4、内容。试题程序:#includestdio.hvoid writeData(int,int b);int findValue(int outBuf)void main()int b20,num;num=findValue(b);writeData(num,b);void writeData(int num,int b)FILE*OUt:int i;out=fopen(OUT.DAT“,“w“);printf(“num=%d/n“,num);fprintf(out,“num=%d/n“,num);for(i=0;inum;i+)printf(“b%d=%d/n“,i,bi);fprintf(ou

5、t,“b%d=%d/n“,i,bi);fclose(out);(分数:100.00)_正确答案:(int findValue(int outBuf)int i,d1,d2,d3,count=0;for(i=10;i*i1000;i+)d1=i*i/100; /*求该平方数的百位数字*/d2=i*i/10%10; /*求该平方数的十位数字*/d3=i*i%10; /*求该平方数的个位数字*/if(d1=d2 | d2=d3|d3=d1)out,Bufcount+=i*i;return count;)解析:解析 本题主要考查数位分解及排序。基本思路是,由于最小的三位数 100 是 10 的平方,因此可以从 10 开始,判断每个数的平方值是否有两位数字相同,直到找到数的平方值大于 999,这样可遍历100999 中所有的平方数,循环中将满足条件的数存入数组 outBuf 中,由于遍历是从小到大的,因此数组 outBuf 中的元素已经接升序排列。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 3774-001-2014 Aerospace series - Circuit breakers three-pole temperature compensated rated currents 1 A to 25 A - Part 001 Technical specification German and English version.pdf DIN EN 3774-001-2014 Aerospace series - Circuit breakers three-pole temperature compensated rated currents 1 A to 25 A - Part 001 Technical specification German and English version.pdf
  • DIN EN 3774-003-1999 Aerospace series - Circuit breakers three-pole temperature compensated rated currents 2 A to 25 A switching capacity 65 I - Part 003 Metric thread terminals pr.pdf DIN EN 3774-003-1999 Aerospace series - Circuit breakers three-pole temperature compensated rated currents 2 A to 25 A switching capacity 65 I - Part 003 Metric thread terminals pr.pdf
  • DIN EN 3774-004-2014 Aerospace series - Circuit breakers three-pole temperature compensated rated currents 1 A to 25 A - Part 004 UNC thread terminals - Product standard German and.pdf DIN EN 3774-004-2014 Aerospace series - Circuit breakers three-pole temperature compensated rated currents 1 A to 25 A - Part 004 UNC thread terminals - Product standard German and.pdf
  • DIN EN 3777-2011 Aerospace series - Pins quick release single and double acting - Technical specification German and English version EN 3777 2010《航空航天系列 插脚 快拆杆 单动和复动 技术规范 德文版本和英文版本.pdf DIN EN 3777-2011 Aerospace series - Pins quick release single and double acting - Technical specification German and English version EN 3777 2010《航空航天系列 插脚 快拆杆 单动和复动 技术规范 德文版本和英文版本.pdf
  • DIN EN 378-3-2017 Refrigerating systems and heat pumps - Safety and environmental requirements - Part 3 Installation site and personal protection German version EN 378-3 2016《制冷系统和.pdf DIN EN 378-3-2017 Refrigerating systems and heat pumps - Safety and environmental requirements - Part 3 Installation site and personal protection German version EN 378-3 2016《制冷系统和.pdf
  • DIN EN 378-4-2017 Refrigerating systems and heat pumps - Safety and environmental requirements - Part 4 Operation maintenance repair and recovery German version EN 378-4 2016《制冷系统和.pdf DIN EN 378-4-2017 Refrigerating systems and heat pumps - Safety and environmental requirements - Part 4 Operation maintenance repair and recovery German version EN 378-4 2016《制冷系统和.pdf
  • DIN EN 3781-2008 Aerospace series - Grooves for spiral wound retaining rings - Design standard German and English version EN 3781 2008《航空航天系列 弹簧绕制固定环用槽 设计标准》.pdf DIN EN 3781-2008 Aerospace series - Grooves for spiral wound retaining rings - Design standard German and English version EN 3781 2008《航空航天系列 弹簧绕制固定环用槽 设计标准》.pdf
  • DIN EN 3782-2008 Aerospace series - Holes for 100 countersunk head screws - Design standard German and English version EN 3782 2008《航空航天系列 100埋头螺钉用孔 设计标准》.pdf DIN EN 3782-2008 Aerospace series - Holes for 100 countersunk head screws - Design standard German and English version EN 3782 2008《航空航天系列 100埋头螺钉用孔 设计标准》.pdf
  • DIN EN 3783-2013 Aerospace series - Fibre composite materials - Normalization of fibre dominated mechanical properties German and English version EN 3783 2013《航空航天系列 纤维复合材料 纤维为主的力学.pdf DIN EN 3783-2013 Aerospace series - Fibre composite materials - Normalization of fibre dominated mechanical properties German and English version EN 3783 2013《航空航天系列 纤维复合材料 纤维为主的力学.pdf
  • 相关搜索

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

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