【计算机类职业资格】三级信息管理技术机试-221及答案解析.doc

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

1、三级信息管理技术机试-221 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制程序 ReadDat()实现从文件 in.dat中读取 100个十六进制数到字符串数组 xx中;再编制函数h16to10(),将 xx中的十六进制数转换成十进制数并把已转换的十进制数仍存放在字符串数组 xx,最后调用函数 WriteDat()把结果输出到 outdat 文件巾。原始数据文件存放的格式是:每行存放 10个数,并用逗号隔开(每个数均大于 0且小于等于 2000)。请勿改动主函数 main()、输出数据函数 writeDAT()的内容。试题源程序#

2、includestdioh#includestdlibh#includestringh#includectypeh#define MAX 10char xxMAX20;void WriteDat(void);int ReadDat(void)FILE*fp;if(fp=fopen(“INDAT,“r“)=NULL)return 1:fclose(fp);return 0;void H16tol0(void)void main()int i;for(i=0;iMAX;i+)memset(xx,0,20);if(ReadDat()printf(“Cant open the data file in

3、dat!007n“);return;H16to10();WriteDat();void WriteDat(void)FILE*fp;int i;fp=fopem(“OUT DAT“,“w“);for(i=0;iMAX;i+)fprintf(fp,“%sn“,xxi);fclose(fp);(分数:100.00)_三级信息管理技术机试-221 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制程序 ReadDat()实现从文件 in.dat中读取 100个十六进制数到字符串数组 xx中;再编制函数h16to10(),将 xx中的十六进制数转

4、换成十进制数并把已转换的十进制数仍存放在字符串数组 xx,最后调用函数 WriteDat()把结果输出到 outdat 文件巾。原始数据文件存放的格式是:每行存放 10个数,并用逗号隔开(每个数均大于 0且小于等于 2000)。请勿改动主函数 main()、输出数据函数 writeDAT()的内容。试题源程序#includestdioh#includestdlibh#includestringh#includectypeh#define MAX 10char xxMAX20;void WriteDat(void);int ReadDat(void)FILE*fp;if(fp=fopen(“IN

5、DAT,“r“)=NULL)return 1:fclose(fp);return 0;void H16tol0(void)void main()int i;for(i=0;iMAX;i+)memset(xx,0,20);if(ReadDat()printf(“Cant open the data file indat!007n“);return;H16to10();WriteDat();void WriteDat(void)FILE*fp;int i;fp=fopem(“OUT DAT“,“w“);for(i=0;iMAX;i+)fprintf(fp,“%sn“,xxi);fclose(fp)

6、分数:100.00)_正确答案:(int ReadDat(void)FILE*fp;int i,data;char n20;if(fp=fopen(“INDAT“,“r“)=NULL)return 1;for(i=0;iMAX;i+)fscanf(fp,“%x“,&data);itoa(data,yy,16);strcpy(xxi,yy);fclose(fp);return 0;void H16tol0(void)int i,data;char yy20;for(i=0;iMAX;i+)data:strtol(xxi,NULL,16);itoa(data,yy,10);strcpy(xxi,yy);)解析:解析 本题主要考查的是进制转换问题。要注意本题还要编写 ReadDat()函数,本题算法较为简单,难点在于几个关键的系统函数如何使用,比如scan(fp,“%x”,&data)的作用是从文件指针 fp指向的文件中读取一个十六进制数存放到变量 data中。H16t010(void)实现从十六进制到十进制的转换,strtol()将字符型转换成长整型数,itoa(data,yy,16)将 data数据转换成字符串,并存入 yy所指的内存单元中,第三个参数表示转换成十六进制数。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 3684-1996 Aerospace Series Test Methods Titanium Alloy Wrought Products Determination of Beta Ray Transus Temperature Metallographic Method Edition P 1《航空航天系列.钛合金锻件产品BET.pdf AECMA PREN 3684-1996 Aerospace Series Test Methods Titanium Alloy Wrought Products Determination of Beta Ray Transus Temperature Metallographic Method Edition P 1《航空航天系列.钛合金锻件产品BET.pdf
  • AECMA PREN 3685-1991 Aerospace Series Bolts in Heat Resisting Steel FE-PA92HT (A286) Classification 1100 MPa 650 Degrees C Technical Specification Issue P 1《航空航天系列.耐热钢 FE-PA92HT(A2.pdf AECMA PREN 3685-1991 Aerospace Series Bolts in Heat Resisting Steel FE-PA92HT (A286) Classification 1100 MPa 650 Degrees C Technical Specification Issue P 1《航空航天系列.耐热钢 FE-PA92HT(A2.pdf
  • AECMA PREN 3686-1991 Aerospace Series Bolts with Double Hexagon Head Relieved Shank Long Thread in Heat Resisting Steel FE-PA92HT (A286) Silver Plated Classification 1100 MPa 650 D.pdf AECMA PREN 3686-1991 Aerospace Series Bolts with Double Hexagon Head Relieved Shank Long Thread in Heat Resisting Steel FE-PA92HT (A286) Silver Plated Classification 1100 MPa 650 D.pdf
  • AECMA PREN 3687-1991 Aerospace Series Bolts Normal Hexagon Head Relieved Shank Long Thread in Heat Resisting Steel FE-PA92HT (A286) Silver Plated Classification 1100 MPa 650 Degree.pdf AECMA PREN 3687-1991 Aerospace Series Bolts Normal Hexagon Head Relieved Shank Long Thread in Heat Resisting Steel FE-PA92HT (A286) Silver Plated Classification 1100 MPa 650 Degree.pdf
  • AECMA PREN 3688-1994 Aerospace Series T-Ring Fillers in Titanium Alloy for Welding Pipes 14 000 kPa Nominal Pressure Edition P 1《航空航天系列.T环填充钛合金焊接管14 000千帕》.pdf AECMA PREN 3688-1994 Aerospace Series T-Ring Fillers in Titanium Alloy for Welding Pipes 14 000 kPa Nominal Pressure Edition P 1《航空航天系列.T环填充钛合金焊接管14 000千帕》.pdf
  • AECMA PREN 3689-1994 Aerospace Series T-Ring Fillers in Titanium Alloy for Welding Pipes 28 000 kPa Nominal Pressure Edition P 1《航空航天系列.T环填充钛合金焊接管28 000千帕》.pdf AECMA PREN 3689-1994 Aerospace Series T-Ring Fillers in Titanium Alloy for Welding Pipes 28 000 kPa Nominal Pressure Edition P 1《航空航天系列.T环填充钛合金焊接管28 000千帕》.pdf
  • AECMA PREN 3690-1994 Aerospace Series Pipe Coupling 8 Degree 30' in Titanium Alloy Unions Bulkhead Long Edition P 1《航空航天系列.钛合金管连接8°30′长防水壁》.pdf AECMA PREN 3690-1994 Aerospace Series Pipe Coupling 8 Degree 30' in Titanium Alloy Unions Bulkhead Long Edition P 1《航空航天系列.钛合金管连接8°30′长防水壁》.pdf
  • AECMA PREN 3691-1994 Aerospace Series Pipe Coupling 8 Degree 30' in Titanium Alloy Unions Bulkhead Long Welded Edition P 1《航空航天系列.钛合金管连接8°30′长防水壁》.pdf AECMA PREN 3691-1994 Aerospace Series Pipe Coupling 8 Degree 30' in Titanium Alloy Unions Bulkhead Long Welded Edition P 1《航空航天系列.钛合金管连接8°30′长防水壁》.pdf
  • AECMA PREN 3696-1994 Aerospace Series Washers in Heat Resisting Steel Edition P 1《航空航天系列.抗热垫圈钢.P1版》.pdf AECMA PREN 3696-1994 Aerospace Series Washers in Heat Resisting Steel Edition P 1《航空航天系列.抗热垫圈钢.P1版》.pdf
  • 相关搜索

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

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