[计算机类试卷]国家三级信息管理技术机试模拟试卷111及答案与解析.doc

上传人:registerpick115 文档编号:494912 上传时间:2018-11-28 格式:DOC 页数:3 大小:27.50KB
下载 相关 举报
[计算机类试卷]国家三级信息管理技术机试模拟试卷111及答案与解析.doc_第1页
第1页 / 共3页
[计算机类试卷]国家三级信息管理技术机试模拟试卷111及答案与解析.doc_第2页
第2页 / 共3页
[计算机类试卷]国家三级信息管理技术机试模拟试卷111及答案与解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家三级信息管理技术机试模拟试卷 111及答案与解析 一、程序设计题 1 已知在文件 IN7.DAT中存有 100个产品销售记录,每个产品销售记录由产品代码 dm(字符型 4位 )、产品名称 mc(字符型 10位 )、单价山 (整型 )、数量 s1(整型 )、金额 je(长整型 )五部分组成。其中:金额单价 数量。函数 ReadDat()的功能是读取这 100个销售记录并存入结构数组 sell中。请编制函数 SortDat(),其功能要求:按金额从大到小进行排列,若金额相同,则按产品代码从大到小进行排列,最终排列结果仍存入结构数组 sell中,最后调用函数 WriteDat()把结果输出到文件

2、OUT7.DAT中。 注意:部分源程序已给出。请勿改动主函数 main()、读数据函数 ReadDat()和输出数据函数 WriteDat()的内容。 试题程序 #include #include #include #include #include #include #include #define MAX 100 typedef struct char dm5; /*产品代码 */ char mc11; /*产品名称 */ int dj; /*单价 */ int s1; /*数量 */ long je; /*金额 */ PRO; PRO sellMAX; void ReadDat(); v

3、oid WriteDat(); void SortDat() void main() memset(sell,0,sizeof(sell); ReadDat(); SortDat(); WriteDat(); void ReadDat() FILE *fp; char str80,ch11; int i; fp=fopen(“IN7.DAT“,“r“); for(i=0;i 100;i+) fgets(str,80,fp); memcpy(selli.dm,str,4); memcpy(selli.mc,str+4,10); memcpy(ch,str+14,4);ch4=0; selli.d

4、j=atot(ch); memcpy(ch,str+18,5);ch5=0; selli.s1=atm(ch); selli.je=(long)selli.dj*selli.s1; fclose(fp); void WriteDat(void) FILE *fp; int i; fp=fopen(“OUT7.DAT“,“w“); for(i=0;i 100;i+) fprintf(fp,“%s%s%4d%5d%101dn“,selli.dm,selli.me,selli.dj;selli.s1,selli.je); fclose(fp); 国家三级信息管理技术机试模拟试卷 111答案与解析 一

5、程序设计题 1 【正确答案】 void SortDat() int i,j; PRO xy; for(i=0;i 99;i+) for(j=i+1;j 100;j+) if selli.je sellj.je) /*按金额从大到小进行排列 */ xy=selli;selli=sellj;sellj=xy; else if(selli.je=sellj.je) /*若金额相同 */ if(strcmp(selli.dm,sellj.dm) 0) /*则按代码从大到小进行排列 */ xy=selli;selli=sellj;sellj=xy; 【试题解析】 此题型考查的知识点包括以下几方面: (1)结构体数组的排序; (2)结构体及结构体数组的相关操作; (3)字符型数组的比较; (4)C语言库函数的使用 (如函数 strcmp()。 此题按金额从大到小进行排列,若金额相等,则按产品代码从大到小进行排列,相应语句为: if(selli.je sellj.je)|(selli.je=sellj.je)&(strcmp(selli.dm,sellj.dm) 0)

展开阅读全文
相关资源
猜你喜欢
  • ASD-STAN PREN 4660-004-2009 Aerospace series Modular and Open Avionics Architectures Part 004 Final draft of Proposed Standards for Packaging (Edition P 1)《航空航天系列 模块化和开放航空电子架构 第004.pdf ASD-STAN PREN 4660-004-2009 Aerospace series Modular and Open Avionics Architectures Part 004 Final draft of Proposed Standards for Packaging (Edition P 1)《航空航天系列 模块化和开放航空电子架构 第004.pdf
  • ASD-STAN PREN 4660-004-2018 Aerospace series - Modular and open avionics architectures - Part 004 Packaging (Edition P 2).pdf ASD-STAN PREN 4660-004-2018 Aerospace series - Modular and open avionics architectures - Part 004 Packaging (Edition P 2).pdf
  • ASD-STAN PREN 4660-005-2009 Aerospace series Modular and Open Avionics Architectures Part 005 Final Draft of Proposed Standards for Software (Edition P 1)《航空航天系列 模块化和开放航空电子架构 第005部.pdf ASD-STAN PREN 4660-005-2009 Aerospace series Modular and Open Avionics Architectures Part 005 Final Draft of Proposed Standards for Software (Edition P 1)《航空航天系列 模块化和开放航空电子架构 第005部.pdf
  • ASD-STAN PREN 4660-005-2018 Aerospace series - Modular and Open Avionics Architectures - Part 005 Software (Edition P 2).pdf ASD-STAN PREN 4660-005-2018 Aerospace series - Modular and Open Avionics Architectures - Part 005 Software (Edition P 2).pdf
  • ASD-STAN PREN 4662-2009 Aerospace series Test specification for vibration control components (Edition P 1)《航空航天系列 振动控制组件的试验规范 第P1版》.pdf ASD-STAN PREN 4662-2009 Aerospace series Test specification for vibration control components (Edition P 1)《航空航天系列 振动控制组件的试验规范 第P1版》.pdf
  • ASD-STAN PREN 4670-2009 Aerospace series Steel FE-PM1507 (X1CrNiMoAlTi12-11-2) Vacuum induction melted and consumable electrode remelted Softened Forging stock a or D Less than or .pdf ASD-STAN PREN 4670-2009 Aerospace series Steel FE-PM1507 (X1CrNiMoAlTi12-11-2) Vacuum induction melted and consumable electrode remelted Softened Forging stock a or D Less than or .pdf
  • ASD-STAN PREN 4671-2009 Aerospace series Steel FE-PM1506 (X1CrNiMoAlTi12-10-2) Vacuum induction melted and consumable electrode remelted Solution treated and precipitation remelted.pdf ASD-STAN PREN 4671-2009 Aerospace series Steel FE-PM1506 (X1CrNiMoAlTi12-10-2) Vacuum induction melted and consumable electrode remelted Solution treated and precipitation remelted.pdf
  • ASD-STAN PREN 4672-2009 Aerospace series Steel FE-PM1504 (X1CrNiMoAlTi12-10-2) Vacuum induction melted and consumable electrode remelted Softened Forging stock a or D Less than or .pdf ASD-STAN PREN 4672-2009 Aerospace series Steel FE-PM1504 (X1CrNiMoAlTi12-10-2) Vacuum induction melted and consumable electrode remelted Softened Forging stock a or D Less than or .pdf
  • ASD-STAN PREN 4673-001-2009 Aerospace series Inserts UNJ threads self-locking with self-broaching keys Part 001 Installation and removal procedure (Edition P 1)《航空航天系列 带自扩孔键的自锁紧UNJ.pdf ASD-STAN PREN 4673-001-2009 Aerospace series Inserts UNJ threads self-locking with self-broaching keys Part 001 Installation and removal procedure (Edition P 1)《航空航天系列 带自扩孔键的自锁紧UNJ.pdf
  • 相关搜索

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

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