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

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

1、三级数据库技术机试-140 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:将大于整数 m 且紧靠 m 的 k 个被 3 除余 1 的素数存入数组 xx。请编写函数 num(int m,imt k,int xx)实现程序的要求,最后调用函数 readwriteDat()把结果输出到文件 out.dat 中。例如:若输入 17,5,则应输出:19,31,37,43,61。部分源程序已给出。请勿改动主函数 main()和输出数据函数 readwriteDat()的内容。#include conio.h#include stdi

2、o.hvoid readwriteDat();void num(int m, int k, int xx)main ( )int m,n,xx1000;clrscr();printf(“/nPlease enter two integers:“);scanf(“ %d%d“ ,num(m,n,xx);for(m=0;mn;m+)printf(“ %d“ ,xxm);printf(“/n“ );readwriteDat();viod readwriteDat()int m,n, xx1000, i;FILE *rf,*wf;rf=fopen(“in.dat“ ,“ r“ );wf=fopen(“

3、 out.dat“ ,“ w“ );for(i=0;i10;i+)fscanf(rf,“ %d%d“ ,num(m,n,xx);for(m=0;mn;m+)fprintf(wf,“ %d“ ,xxmfprintf(wf,“/n“ );fclose(rf);fclose(wf);(分数:100.00)_三级数据库技术机试-140 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:将大于整数 m 且紧靠 m 的 k 个被 3 除余 1 的素数存入数组 xx。请编写函数 num(int m,imt k,int xx)实现程序的要求,

4、最后调用函数 readwriteDat()把结果输出到文件 out.dat 中。例如:若输入 17,5,则应输出:19,31,37,43,61。部分源程序已给出。请勿改动主函数 main()和输出数据函数 readwriteDat()的内容。#include conio.h#include stdio.hvoid readwriteDat();void num(int m, int k, int xx)main ( )int m,n,xx1000;clrscr();printf(“/nPlease enter two integers:“);scanf(“ %d%d“ ,num(m,n,xx)

5、for(m=0;mn;m+)printf(“ %d“ ,xxm);printf(“/n“ );readwriteDat();viod readwriteDat()int m,n, xx1000, i;FILE *rf,*wf;rf=fopen(“in.dat“ ,“ r“ );wf=fopen(“ out.dat“ ,“ w“ );for(i=0;i10;i+)fscanf(rf,“ %d%d“ ,num(m,n,xx);for(m=0;mn;m+)fprintf(wf,“ %d“ ,xxmfprintf(wf,“/n“ );fclose(rf);fclose(wf);(分数:100.00)

6、正确答案:(提示:类型:素数判断与运算。关键点:素数判定。求素数的题,可以先定义一个求素数的函数,然后在程序中直接调用,这样简单而且不容易出错。原程序如果给了求素数的函数,可以直接调用。解答:/*判定 m 是否为素数*/int isP(int m)int i;for ( i=2; im; i+)if(m % i=O)return 0;/*用小于 m 的所有整数去试除*/*除尽则 m 不是素数*/*此步有优化余地*/return 1;/*寻找满足条件的素数*/void num(int m, int k, int xx)int s=0;for (+m; k0 ;m+)if (m%3=1 k-;)解析:

展开阅读全文
相关资源
猜你喜欢
  • BS EN 969-2009 Ductile iron pipes fittings accessories and their joints for gas pipelines - Requirements and test methods《输气用球墨铸铁管 配件 附件及其接头 要求和测试方法》.pdf BS EN 969-2009 Ductile iron pipes fittings accessories and their joints for gas pipelines - Requirements and test methods《输气用球墨铸铁管 配件 附件及其接头 要求和测试方法》.pdf
  • BS EN 973-2009 Chemicals used for treatment of water intended for human consumption - Sodium chloride for regeneration of ion exchangers《人消耗用水的处理用的化学物质 离子交换器再生用氯化钠》.pdf BS EN 973-2009 Chemicals used for treatment of water intended for human consumption - Sodium chloride for regeneration of ion exchangers《人消耗用水的处理用的化学物质 离子交换器再生用氯化钠》.pdf
  • BS EN 974-2004 Chemicals used for treatment of water intended for human consumption - Phosphoric acid《人类生活用水处理用化学物质 磷酸》.pdf BS EN 974-2004 Chemicals used for treatment of water intended for human consumption - Phosphoric acid《人类生活用水处理用化学物质 磷酸》.pdf
  • BS EN 975-1-2009 Sawn timber — nAppearance grading of nhardwoods nPart 1 Oak and beech《木材 硬木锯材的目测分级 第1部分 橡树和山毛榉》.pdf BS EN 975-1-2009 Sawn timber — nAppearance grading of nhardwoods nPart 1 Oak and beech《木材 硬木锯材的目测分级 第1部分 橡树和山毛榉》.pdf
  • BS EN 975-2-2004 Sawn timber - Appearance grading of hardwoods - Part 2 Poplars《锯木 硬木锯材的目测分级 白杨木》.pdf BS EN 975-2-2004 Sawn timber - Appearance grading of hardwoods - Part 2 Poplars《锯木 硬木锯材的目测分级 白杨木》.pdf
  • BS EN 976-1-1997 Underground tanks of glass-reinforced plastics (GRP) - Horizontal cylindrical tanks for the non-pressure storage of liquid petroleum based fuels - Requirements and.pdf BS EN 976-1-1997 Underground tanks of glass-reinforced plastics (GRP) - Horizontal cylindrical tanks for the non-pressure storage of liquid petroleum based fuels - Requirements and.pdf
  • BS EN 976-2-1997 Underground tanks of glass-reinforced plastics (GRP) - Horizontal cylindrical tanks for the non-pressure storage of liquid petroleum based fuels - Transport handli.pdf BS EN 976-2-1997 Underground tanks of glass-reinforced plastics (GRP) - Horizontal cylindrical tanks for the non-pressure storage of liquid petroleum based fuels - Transport handli.pdf
  • BS EN 977-1998 Underground tanks of glass-reinforced plastics (GRP) - Method for one side exposure to fluids《玻璃增强塑料地下水箱(GRP) 单侧液流法》.pdf BS EN 977-1998 Underground tanks of glass-reinforced plastics (GRP) - Method for one side exposure to fluids《玻璃增强塑料地下水箱(GRP) 单侧液流法》.pdf
  • BS EN 978-1997 Underground tanks of glass-reinforced plastics (GRP) - Determination of factor and factor 《玻璃纤维增强塑料地下水箱 ALPHA因子和β因子的测定》.pdf BS EN 978-1997 Underground tanks of glass-reinforced plastics (GRP) - Determination of factor and factor 《玻璃纤维增强塑料地下水箱 ALPHA因子和β因子的测定》.pdf
  • 相关搜索

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

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