【计算机类职业资格】三级网络技术机试-30及答案解析.doc

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

1、三级网络技术机试-30 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.已知数据文件 IN89.DAT中存有 200个 4位数,并已调用读函数 readDat()把这些数存入数组 a中。请编制一函数 jsVal(),其功能是:如果一个 4位数的千位数字上的值加个位数字上的值恰好等于百位数字上的值加上十位数字上的值,并且此 4位数是奇数,则统计出满足此条件的数的个数 cnt并把这些 4位数按从小到大的顺序存入数组 b中,最后调用写函数 writeDat()把结果 cnt以及数组 b中符个条件的 4位数输出到 OUT89.DAT文件中。注意:部

2、分源程序已给出。程序中已定义数组:a200,b200,已定义变量:cnt。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序:#includestdio.h#define MAX 200int aMAX,bMAX,cnt=0;void jsVal() void readDat ()int i;FILE *fp;fp=fopen(“IN89.DAT“,“r“);for (i=0; iMAX; i+)fscanf(fp,“%d“,fclese(fp);main()int i;readDat ();jsVal ();printf (“满足条件的数=

3、d/n“, cnt);for(i=0;icnt;i+)printf(“%d“,bi);printf(“/n“);writeDat();writeDat()FILE *fp;int i;fp=fopen (“OUT89.DAT“, “w“);fprintf (fp, “%d/n“, cnt);for(i=0;icnt;i+)fprintf(fp,“%d/n“,bi );fclose(fp);(分数:100.00)A.B.C.D.三级网络技术机试-30 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.已知数据文件 IN89.DAT中存有 200

4、个 4位数,并已调用读函数 readDat()把这些数存入数组 a中。请编制一函数 jsVal(),其功能是:如果一个 4位数的千位数字上的值加个位数字上的值恰好等于百位数字上的值加上十位数字上的值,并且此 4位数是奇数,则统计出满足此条件的数的个数 cnt并把这些 4位数按从小到大的顺序存入数组 b中,最后调用写函数 writeDat()把结果 cnt以及数组 b中符个条件的 4位数输出到 OUT89.DAT文件中。注意:部分源程序已给出。程序中已定义数组:a200,b200,已定义变量:cnt。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试

5、题程序:#includestdio.h#define MAX 200int aMAX,bMAX,cnt=0;void jsVal() void readDat ()int i;FILE *fp;fp=fopen(“IN89.DAT“,“r“);for (i=0; iMAX; i+)fscanf(fp,“%d“,fclese(fp);main()int i;readDat ();jsVal ();printf (“满足条件的数=%d/n“, cnt);for(i=0;icnt;i+)printf(“%d“,bi);printf(“/n“);writeDat();writeDat()FILE *f

6、p;int i;fp=fopen (“OUT89.DAT“, “w“);fprintf (fp, “%d/n“, cnt);for(i=0;icnt;i+)fprintf(fp,“%d/n“,bi );fclose(fp);(分数:100.00)A.B. C.D.解析:解析 本题考查的知识点如下:(1)运算符“%”及“/”的使用。(2)选择结构中多个条件的布匀;运算。(3)数据的排序。在本题中,首先要将一个 4位数的千位、百位、十位、个位拆成独立的数字。这里借助特殊运算符号“%” (取余)和“/” (整除),拆分方法略。一个数除以 2取余所得的数为 1,则这个数是奇数。题中给出的两个条件必须同时满足,所以两条件之间用“与”运算。将符合条件的数先存入数组 b中,再对 b中的数据进行排序。排序使用“选择排序法”。

展开阅读全文
相关资源
猜你喜欢
  • GOST 31643-2012 Juice products Determination of ascorbic acid by High Performance Liquid Chromatography (HPLC) method《果汁产品 高效液相色谱(HPLC)方法测定抗坏血酸》.pdf GOST 31643-2012 Juice products Determination of ascorbic acid by High Performance Liquid Chromatography (HPLC) method《果汁产品 高效液相色谱(HPLC)方法测定抗坏血酸》.pdf
  • GOST 31644-2012 Juice products Determination of 5-Hydroxymethylfurfural (HMF) by High Performance Liquid Chromatography (HPLC) method《5-羟甲基糠醛(HMF)的高效液相色谱测定法(HPLC)》.pdf GOST 31644-2012 Juice products Determination of 5-Hydroxymethylfurfural (HMF) by High Performance Liquid Chromatography (HPLC) method《5-羟甲基糠醛(HMF)的高效液相色谱测定法(HPLC)》.pdf
  • GOST 31645-2012 Flour for baby-s nutrition Specifications《婴儿营养粉状物 规格》.pdf GOST 31645-2012 Flour for baby-s nutrition Specifications《婴儿营养粉状物 规格》.pdf
  • GOST 31646-2012 Cereals Method for determination of scabby kernels content《谷物 结痂仁含量的测定方法》.pdf GOST 31646-2012 Cereals Method for determination of scabby kernels content《谷物 结痂仁含量的测定方法》.pdf
  • GOST 31649-2012 Decorative cosmetic stuffs on fatty and waxy basis General specifications《脂肪和蜡质基的装饰品 通用规格》.pdf GOST 31649-2012 Decorative cosmetic stuffs on fatty and waxy basis General specifications《脂肪和蜡质基的装饰品 通用规格》.pdf
  • GOST 31650-2012 Medical remedies for animals feed and feed additives Detection of mass fraction of mercury by atom absorbtion spectrometric method《动物医学治疗的饲料和饲料添加剂 检测汞质量分数的原子吸收光谱测定方.pdf GOST 31650-2012 Medical remedies for animals feed and feed additives Detection of mass fraction of mercury by atom absorbtion spectrometric method《动物医学治疗的饲料和饲料添加剂 检测汞质量分数的原子吸收光谱测定方.pdf
  • GOST 31651-2012 Medical remedies for animals feed and feed additives Detection of mass fraction of selenium by atom absorbtion spectrometric method《动物、饲料及饲料添加剂的医学治疗 通过原子吸收光谱测定方法检测硒.pdf GOST 31651-2012 Medical remedies for animals feed and feed additives Detection of mass fraction of selenium by atom absorbtion spectrometric method《动物、饲料及饲料添加剂的医学治疗 通过原子吸收光谱测定方法检测硒.pdf
  • GOST 31653-2012 Feedstuffs Method of immunoenzyme mycotoxin determination《饲料 免疫酶霉菌毒素的测定方法》.pdf GOST 31653-2012 Feedstuffs Method of immunoenzyme mycotoxin determination《饲料 免疫酶霉菌毒素的测定方法》.pdf
  • GOST 31655-2012 Food eggs (turkey guinea-fowl quail ostrich) Specifications《食用蛋类(火鸡、珍珠鸡、鹌鹑、鸵鸟) 规格》.pdf GOST 31655-2012 Food eggs (turkey guinea-fowl quail ostrich) Specifications《食用蛋类(火鸡、珍珠鸡、鹌鹑、鸵鸟) 规格》.pdf
  • 相关搜索

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

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