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

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

1、三级数据库技术机试-213 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制函数 ReadDat(),实现从文件 IN.DAT中读取 1000个十进制整数到数组 xx中;请编制函数Compute(),分别计算出 XX中偶数的个数 even,奇数的平均值 ave1,偶数的平均值 ave2以及方差 totfc的值,最后调用函数 WriteDat()把结果输出到 OUT.DAT文件中。计算方差的公式如下:(分数:100.00)_三级数据库技术机试-213 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:10

2、0.00)1.请编制函数 ReadDat(),实现从文件 IN.DAT中读取 1000个十进制整数到数组 xx中;请编制函数Compute(),分别计算出 XX中偶数的个数 even,奇数的平均值 ave1,偶数的平均值 ave2以及方差 totfc的值,最后调用函数 WriteDat()把结果输出到 OUT.DAT文件中。计算方差的公式如下:(分数:100.00)_正确答案:(for(i=1;iMAX;i+)fscanf(fp,“%d,“,Lxxi);/读取文件中的数据存入变量 xxi中if(i+1)%10=0)/每行存 10个数fscanf(fp,“ “);/读取行后的换行符)解析:解析 本题考查文件的操作、奇偶判断和数学公式的计算。函数 ReadDat的作用是从文件中读取数据存入数组 xx中,因为数据存入文件的格式是每个数据被逗号隔开,所以fscanf(fp,“%d,“,xxi)语句中的字符串“%d,“要加入逗号。函数 Compute的作用是计算方差,思路是首先顺序读取数组 xx中的结点,若是偶数则累加存入 ave2,个数存入 even,若不是偶数(即为奇数)则累加结果存入 ave1,个数存入 odd。然后计算奇数和偶数的平均数,利用循环结构依次读取存放偶数的数组 yy,计算方差 totfc。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 302092-2-2000 Broadband Integrated Services Digital Network (B-ISDN) and Broadband Private Integrated Services Network (B-PISN) - Digital Subscriber Signalling System No two.pdf DIN EN 302092-2-2000 Broadband Integrated Services Digital Network (B-ISDN) and Broadband Private Integrated Services Network (B-PISN) - Digital Subscriber Signalling System No two.pdf
  • DIN EN 302092-3-2001 Broadband Integrated Services Digital Network (B-ISDN) and Broadband Private Integrated Services Network (B-PISN) - Digital Subscriber Signalling System No two.pdf DIN EN 302092-3-2001 Broadband Integrated Services Digital Network (B-ISDN) and Broadband Private Integrated Services Network (B-PISN) - Digital Subscriber Signalling System No two.pdf
  • DIN EN 302092-4-2001 Broadband Integrated Services Digital Network (B-ISDN) and Broadband Private Integrated Services Network (B-PISN) - Digital Subscriber Signalling System No two.pdf DIN EN 302092-4-2001 Broadband Integrated Services Digital Network (B-ISDN) and Broadband Private Integrated Services Network (B-PISN) - Digital Subscriber Signalling System No two.pdf
  • DIN EN 302093-1-2000 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf DIN EN 302093-1-2000 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf
  • DIN EN 302093-2-2000 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf DIN EN 302093-2-2000 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf
  • DIN EN 302093-3-2000 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf DIN EN 302093-3-2000 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf
  • DIN EN 302093-4-2001 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf DIN EN 302093-4-2001 Broadband Integrated Services Digital Network (B-ISDN) - Digital Subscriber Signalling System No two (DSS2) protocol Point-to-point multiconnection bearer cont.pdf
  • DIN EN 302094-1-2000 Integrated Services Digital Network (ISDN) - Digital Subscriber Signalling System No one (DSS1) and Signalling System No 7 (SS7) protocols Call Forwarding on N.pdf DIN EN 302094-1-2000 Integrated Services Digital Network (ISDN) - Digital Subscriber Signalling System No one (DSS1) and Signalling System No 7 (SS7) protocols Call Forwarding on N.pdf
  • DIN EN 302094-2-2000 Integrated Services Digital Network (ISDN) - Digital Subscriber Signalling System No one (DSS1) and Signalling System No 7 (SS7) protocols Call Forwarding on N.pdf DIN EN 302094-2-2000 Integrated Services Digital Network (ISDN) - Digital Subscriber Signalling System No one (DSS1) and Signalling System No 7 (SS7) protocols Call Forwarding on N.pdf
  • 相关搜索

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

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