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

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

1、三级数据库技术-543 及答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.程序 PROG1.G 的功能是:寻找并输出 11 至 999 之间的数 m,它满足 m、m 2 和 m 3 均为回文数。所谓回文数是指其各位数字左右对称的整数,例如 121,676,94249 等。满足上述条件的数如 m=11,m 2 =121,m 3 =1331 皆为回文数。请考生编制函数 int JsValue(long m)实现此功能,如果是回文数,则函数返回 1,反之则返回 0。最后把结果输出到文件 out.dat 中。 请勿改动主函数 main()。 #

2、include stdio.h int jsValue(long m) main () long m; FILE *out; out=fopen(“out.dat“, “w“); /以只写的方式打开文件 out.dat,并使文件指针 out 指向此文件 /*对在 11 至 999 之间的数 m 进行扫描,调用函数 jsValue()进行判断,如果 m, m2, m3 都是回文,则把这三个数输出到屏幕上并输出到文件 out.dat 中*/ for(m=11; m1000; m+) if(jsValue(m) fprintf(out, “m=%41d,m*m=%61d, m*m*m=%81dn“,

3、 m, m*m, m*m*m); fclose (out); /关闭 out.dat 文件 (分数:100.00)_三级数据库技术-543 答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.程序 PROG1.G 的功能是:寻找并输出 11 至 999 之间的数 m,它满足 m、m 2 和 m 3 均为回文数。所谓回文数是指其各位数字左右对称的整数,例如 121,676,94249 等。满足上述条件的数如 m=11,m 2 =121,m 3 =1331 皆为回文数。请考生编制函数 int JsValue(long m)实现此功能,如果是回文

4、数,则函数返回 1,反之则返回 0。最后把结果输出到文件 out.dat 中。 请勿改动主函数 main()。 #include stdio.h int jsValue(long m) main () long m; FILE *out; out=fopen(“out.dat“, “w“); /以只写的方式打开文件 out.dat,并使文件指针 out 指向此文件 /*对在 11 至 999 之间的数 m 进行扫描,调用函数 jsValue()进行判断,如果 m, m2, m3 都是回文,则把这三个数输出到屏幕上并输出到文件 out.dat 中*/ for(m=11; m1000; m+) i

5、f(jsValue(m) fprintf(out, “m=%41d,m*m=%61d, m*m*m=%81dn“, m, m*m, m*m*m); fclose (out); /关闭 out.dat 文件 (分数:100.00)_正确答案:()解析:long i,n; i=m; n=0; /*在 while 循环体中对组成整数 i 的各位上的数字进行逆序排列*/ while(i) n=n*10+i%10; i/=10; return m=n; /如果逆序排列后的数与原数相同,则返回 1 解析 回文数字。 定义长整型变量 i、n,并分别赋给初值 m、0(m 的值等于主函数中 m 循环变量的值)。 当变量 i 的值非零时,即 m 值不为 0 时,把 n 乘以 10 加上 i 除以 10 所得的余数的和赋给变量 n,把 i除以 10 所得的商,赋给变量 i。实现对整数 i 各位上的数字进行逆序排列。 当退出 while 循环时,判断 n 是否等于 m,如果两者相等,则说明参数 m 是回文,返回 1,否则,不是回文,返回 0。

展开阅读全文
相关资源
猜你喜欢
  • BS PD CEN TS 15634-3-2016 Foodstuffs Detection of food allergens by molecular biological methods Hazelnut (Corylus avellana) Qualitative detection of a specific DNA sequence in cho.pdf BS PD CEN TS 15634-3-2016 Foodstuffs Detection of food allergens by molecular biological methods Hazelnut (Corylus avellana) Qualitative detection of a specific DNA sequence in cho.pdf
  • BS PD CEN TS 15634-4-2016 Foodstuffs Detection of food allergens by molecular biological methods Peanut (Arachis hypogaea) Qualitative detection of a specific DNA sequence in choco.pdf BS PD CEN TS 15634-4-2016 Foodstuffs Detection of food allergens by molecular biological methods Peanut (Arachis hypogaea) Qualitative detection of a specific DNA sequence in choco.pdf
  • BS PD CEN TS 15634-5-2016 Foodstuffs Detection of food allergens by molecular biological methods Mustard (Sinapis alba) and soya (Glycine max) Qualitative detection of a specific D食.pdf BS PD CEN TS 15634-5-2016 Foodstuffs Detection of food allergens by molecular biological methods Mustard (Sinapis alba) and soya (Glycine max) Qualitative detection of a specific D食.pdf
  • BS PD CEN TS 15864-2015 Characterization of waste Leaching behaviour test for basic characterization Dynamic monolithic leaching test with continuous leachant renewal under conditi.pdf BS PD CEN TS 15864-2015 Characterization of waste Leaching behaviour test for basic characterization Dynamic monolithic leaching test with continuous leachant renewal under conditi.pdf
  • BS PD CEN TS 15901-14-2016 Road and airfield surface characteristics Procedure for determining the skid resistance of a pavement surface using a device with longitudinal controlled.pdf BS PD CEN TS 15901-14-2016 Road and airfield surface characteristics Procedure for determining the skid resistance of a pavement surface using a device with longitudinal controlled.pdf
  • BS PD CEN TS 15901-15-2014 Road and airfield surface characteristics Procedure for determining the skid resistance of a pavement surface using a device with longitudinal controlled.pdf BS PD CEN TS 15901-15-2014 Road and airfield surface characteristics Procedure for determining the skid resistance of a pavement surface using a device with longitudinal controlled.pdf
  • BS PD CEN TS 15963-2014 Bitumen and bituminous binders Determination of the fracture toughness temperature by a three point bending test on a notched specimen《沥青和沥青混合料 切口试样上用三点弯曲试验.pdf BS PD CEN TS 15963-2014 Bitumen and bituminous binders Determination of the fracture toughness temperature by a three point bending test on a notched specimen《沥青和沥青混合料 切口试样上用三点弯曲试验.pdf
  • BS PD CEN TS 15968-2010 Determination of extractable perfluorooctanesulphonate (PFOS) in coated and impregnated solid articles liquids and fire fighting foams Method for sampling e涂.pdf BS PD CEN TS 15968-2010 Determination of extractable perfluorooctanesulphonate (PFOS) in coated and impregnated solid articles liquids and fire fighting foams Method for sampling e涂.pdf
  • BS PD CEN TS 15989-2015 Firefighting and rescue service vehicles and equipment Graphical symbols for control elements and displays and for markings《消防和救援车辆及设备 标记的控制元素和显示用图形符号》.pdf BS PD CEN TS 15989-2015 Firefighting and rescue service vehicles and equipment Graphical symbols for control elements and displays and for markings《消防和救援车辆及设备 标记的控制元素和显示用图形符号》.pdf
  • 相关搜索

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

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