【计算机类职业资格】三级网络技术机试-161及答案解析.doc

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

1、三级网络技术机试-161 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:已知学生的记录由学号和学习成绩构成,N 名学生的数据已存入数组 a中,找出成绩最高的学生的记录(假定最高成绩记录是唯一的),通过形参返回。请编写函数 mmm(STU a,STU*s)实现程序要求,最后调用函数 reawriteDAT()把结果输出到文件 out.dat中。例如:KS01 87KS09 67KS11 97则调用该函数后将输出:The lowest:KS09,67注意:部分源程序已给出。请勿改动主函数 main()和函数 readwrit

2、eDAT()的内容。试题源程序#includeStdio.h#includestring.h#includeconio.h#defime N 10void readwriteDat();typedef struct sschar num10;int s;STU;void mmm(STU a,STU*s)msin()STUaN=“A01“,81,“A02“,89),“A03“,81),“A01“,66),“A04“,87),“A05“,77),“A07“,79),“A08“,61),“A09“,80,“A10“,71,),m;int i;System(“cls“);printf(“* The o

3、riginal data * /n“);for(i=0;iN;i+) printf(“No=%s Mark=%d/n“,ai.num,ai.s);mmm(a,printf(“* THE RESULT*/n“);printf(“The highest:%s,%d/n“,m.num,m.s);readwriteDat();void readwriteDat()FILE *rf,*wf;STU aN,m;int i;rf=fopen(“in.dat“,“r“);wf=fopen(“out.dat“,“w“);for(i=0;i10;i+)fscanf(rf,“%s%d“,ai.num,mmm(a,f

4、printf(wf,“The lowest:%s,%d/n“,m.num,m.s);fclose(rf);fclose(wf);(分数:100.00)_三级网络技术机试-161 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:已知学生的记录由学号和学习成绩构成,N 名学生的数据已存入数组 a中,找出成绩最高的学生的记录(假定最高成绩记录是唯一的),通过形参返回。请编写函数 mmm(STU a,STU*s)实现程序要求,最后调用函数 reawriteDAT()把结果输出到文件 out.dat中。例如:KS01 87KS09 6

5、7KS11 97则调用该函数后将输出:The lowest:KS09,67注意:部分源程序已给出。请勿改动主函数 main()和函数 readwriteDAT()的内容。试题源程序#includeStdio.h#includestring.h#includeconio.h#defime N 10void readwriteDat();typedef struct sschar num10;int s;STU;void mmm(STU a,STU*s)msin()STUaN=“A01“,81,“A02“,89),“A03“,81),“A01“,66),“A04“,87),“A05“,77),“A

6、07“,79),“A08“,61),“A09“,80,“A10“,71,),m;int i;System(“cls“);printf(“* The original data * /n“);for(i=0;iN;i+) printf(“No=%s Mark=%d/n“,ai.num,ai.s);mmm(a,printf(“* THE RESULT*/n“);printf(“The highest:%s,%d/n“,m.num,m.s);readwriteDat();void readwriteDat()FILE *rf,*wf;STU aN,m;int i;rf=fopen(“in.dat“,

7、r“);wf=fopen(“out.dat“,“w“);for(i=0;i10;i+)fscanf(rf,“%s%d“,ai.num,mmm(a,fprintf(wf,“The lowest:%s,%d/n“,m.num,m.s);fclose(rf);fclose(wf);(分数:100.00)_正确答案:(void mmm(STU a,STU *s)int i;s-s=a0.s;for(i=1;iN;i+)if(ai.ss-s)*s=ai;)解析:解析本题考查的是查询最小值的问题。本题的关键在于结构体变量的使用及指针的使用。结构体的成员变量为“ai.s”,而结构体指针的成员变量为“s-s”。用一个 for循环遍历结构体数组。中的结构体,内嵌 if语句使指针 s指向扫描过所有结构体中成员变量 s的最小结构体。这样,遍历完所有的结构体后,指针 s将指向结构体成员变量 s的最小结构体。

展开阅读全文
相关资源
猜你喜欢
  • SANS 301669-2005 Fixed Radio Systems Point-to-point equipment High capacity digital radio systems carrying STM-4 in two 40 MHz channels or 2 x STM-1 in a 40 MHz channel with altern.pdf SANS 301669-2005 Fixed Radio Systems Point-to-point equipment High capacity digital radio systems carrying STM-4 in two 40 MHz channels or 2 x STM-1 in a 40 MHz channel with altern.pdf
  • SANS 301751-2005 Fixed Radio Systems Point-to-point equipments and antennas Generic harmonized standard for Point-to-Point digital fixed radio systems and antennas covering the ess19.pdf SANS 301751-2005 Fixed Radio Systems Point-to-point equipments and antennas Generic harmonized standard for Point-to-Point digital fixed radio systems and antennas covering the ess19.pdf
  • SANS 301753-2005 Fixed Radio Systems Multipoint equipment and antennas Generic harmonized standard for multipoint digital fixed radio systems and antennas covering the essential re 1.pdf SANS 301753-2005 Fixed Radio Systems Multipoint equipment and antennas Generic harmonized standard for multipoint digital fixed radio systems and antennas covering the essential re 1.pdf
  • SANS 301797-2005 Electromagnetic compatibility and Radio Spectrum Matters (ERM) Harmonized EN for CT2 cordless telephone equipment covering essential requirements under article 3 2.pdf SANS 301797-2005 Electromagnetic compatibility and Radio Spectrum Matters (ERM) Harmonized EN for CT2 cordless telephone equipment covering essential requirements under article 3 2.pdf
  • SANS 301843-2-2005 Electromagnetic compatibility and Radio spectrum Matters (ERM) ElectroMagnetic Compatibility (EMC) standard for marine radio equipment and services Part 2 Specifte.pdf SANS 301843-2-2005 Electromagnetic compatibility and Radio spectrum Matters (ERM) ElectroMagnetic Compatibility (EMC) standard for marine radio equipment and services Part 2 Specifte.pdf
  • SANS 301908-9-2006 Electromagnetic compatibility and Radio spectrum Matters (ERM) Base Stations (BS) Repeaters and User Equipment (UE) for IMT-2000 Third-Generation cellular networgl.pdf SANS 301908-9-2006 Electromagnetic compatibility and Radio spectrum Matters (ERM) Base Stations (BS) Repeaters and User Equipment (UE) for IMT-2000 Third-Generation cellular networgl.pdf
  • SANS 303-2005 Non-automatic non-self-indicating or semi-self-indicating ungraduated counter scales subject to legal metrology control《需遵守法定计量管制的非自动、非自指示或半自动指示无刻度案秤》.pdf SANS 303-2005 Non-automatic non-self-indicating or semi-self-indicating ungraduated counter scales subject to legal metrology control《需遵守法定计量管制的非自动、非自指示或半自动指示无刻度案秤》.pdf
  • SANS 303035-1-2004 Terrestrial Trunked Radio (TETRA) Harmonized EN for TETRA equipment covering essential requirements under article 3 2 of the R&TTE Directive Part 1 Voice plus Da.pdf SANS 303035-1-2004 Terrestrial Trunked Radio (TETRA) Harmonized EN for TETRA equipment covering essential requirements under article 3 2 of the R&TTE Directive Part 1 Voice plus Da.pdf
  • SANS 303035-2-2004 Terrestrial Trunked Radio (TETRA) Harmonized EN for TETRA equipment covering essential requirements under article 3 2 of the R&TTE Directive Part 2 Direct Mode O.pdf SANS 303035-2-2004 Terrestrial Trunked Radio (TETRA) Harmonized EN for TETRA equipment covering essential requirements under article 3 2 of the R&TTE Directive Part 2 Direct Mode O.pdf
  • 相关搜索

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

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