【计算机类职业资格】三级数据库技术机试-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-;)解析:

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 3841-100-1998 Aerospace Series Circuit Breakers Test Methods Part 100  General Edition P 2《航空航天系列.断路器试验方法.第100部分 总则》.pdf AECMA PREN 3841-100-1998 Aerospace Series Circuit Breakers Test Methods Part 100 General Edition P 2《航空航天系列.断路器试验方法.第100部分 总则》.pdf
  • AECMA PREN 3841-201-1996 Aerospace Series Circuit Breakers Test Methods Part 201  Visual Inspection Edition P 1《航空航天系列 断路器试验方法.第201部分 目视检查》.pdf AECMA PREN 3841-201-1996 Aerospace Series Circuit Breakers Test Methods Part 201 Visual Inspection Edition P 1《航空航天系列 断路器试验方法.第201部分 目视检查》.pdf
  • AECMA PREN 3841-202-1996 Aerospace Series Circuit Breakers Test Methods Part 202  Dimensions and Masses Edition P 1《航空航天系列 断路器试验方法.第202部分 尺寸和质量》.pdf AECMA PREN 3841-202-1996 Aerospace Series Circuit Breakers Test Methods Part 202 Dimensions and Masses Edition P 1《航空航天系列 断路器试验方法.第202部分 尺寸和质量》.pdf
  • AECMA PREN 3841-301-1998 Aerospace Series Circuit Breakers Test Methods Part 301  Voltage Drop Edition P 2《航空航天系列.断路器试验方法.第301部分 电压降》.pdf AECMA PREN 3841-301-1998 Aerospace Series Circuit Breakers Test Methods Part 301 Voltage Drop Edition P 2《航空航天系列.断路器试验方法.第301部分 电压降》.pdf
  • AECMA PREN 3841-302-1998 Aerospace Series Circuit Breakers Test Methods Part 302  Insulation Resistance Edition P 2《航空航天系列.断路器试验方法.第302部分 绝缘电阻抗》.pdf AECMA PREN 3841-302-1998 Aerospace Series Circuit Breakers Test Methods Part 302 Insulation Resistance Edition P 2《航空航天系列.断路器试验方法.第302部分 绝缘电阻抗》.pdf
  • AECMA PREN 3841-303-1998 Aerospace Series Circuit Breakers Test Methods Part 303  Dielectric Strength Edition P 2《航空航天系列.断路器试验方法.第303部分 绝缘强度》.pdf AECMA PREN 3841-303-1998 Aerospace Series Circuit Breakers Test Methods Part 303 Dielectric Strength Edition P 2《航空航天系列.断路器试验方法.第303部分 绝缘强度》.pdf
  • AECMA PREN 3841-304-1998 Aerospace Series Circuit Breakers Test Methods Part 304  Tripping Points Edition P 2《航空航天系列.断路器试验方法.第304部分 跳闸点》.pdf AECMA PREN 3841-304-1998 Aerospace Series Circuit Breakers Test Methods Part 304 Tripping Points Edition P 2《航空航天系列.断路器试验方法.第304部分 跳闸点》.pdf
  • AECMA PREN 3841-305-1998 Areospace Series Circuit Breakers Test Methods Part 305  Short-Circuit Performance Edition P 2《航空航天系列.断路器试验方法.第305部分 短路性能》.pdf AECMA PREN 3841-305-1998 Areospace Series Circuit Breakers Test Methods Part 305 Short-Circuit Performance Edition P 2《航空航天系列.断路器试验方法.第305部分 短路性能》.pdf
  • AECMA PREN 3841-306-2003 Aerospace Series Circuit Breakers Test Methods Part 306 Service Life Edition P 3《航空航天系列.断路器试验方法.第306部分 使用寿命》.pdf AECMA PREN 3841-306-2003 Aerospace Series Circuit Breakers Test Methods Part 306 Service Life Edition P 3《航空航天系列.断路器试验方法.第306部分 使用寿命》.pdf
  • 相关搜索

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

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