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

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

1、三级信息管理技术机试-271 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:把 s 字符串中所有的字符左移一个位置,串中的第一个字符移到最后。请编制函数chg(char*s)实现程序要求,最后调用函数 readwriteDat()把结果输出到 out61.dat 文件中。例如:s 字符串中原有内容为 Mn,123xyZ,则调用该函数后,结果为 n,123xyZM。注意:部分源程序已给出。请勿改动主函数 main()和输入输出函数 readwriteDAT()的内容。试题程序#includestring.h#include

2、stdlib.h#includestdio.h#defiRe N 81void readwriteDAT();void chg(char*s)voidmain()char aN;system(“CLS“);printf(“Enter a string:“);gets(a);printf(“The original string is:“);puts(a);chg(a);print f(“The string after modi fied:“);puts(a);readwriteDAT();void readwriteDAT()int i;char aN;unsigned char*P;FIL

3、E*rf,*wf;rf=fopen(“in61.dat“,“r“);wf=fopen(“out61.dat“,“w“);for(i=0;i10;i+)fgets(a,80,rf);P=strchr(a,/n);if(P) *P=0;chg(a);fprintf(wf,“%s/n,a);fclose(rf);fclose(wf);(分数:100.00)_三级信息管理技术机试-271 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:把 s 字符串中所有的字符左移一个位置,串中的第一个字符移到最后。请编制函数chg(char*s)

4、实现程序要求,最后调用函数 readwriteDat()把结果输出到 out61.dat 文件中。例如:s 字符串中原有内容为 Mn,123xyZ,则调用该函数后,结果为 n,123xyZM。注意:部分源程序已给出。请勿改动主函数 main()和输入输出函数 readwriteDAT()的内容。试题程序#includestring.h#includestdlib.h#includestdio.h#defiRe N 81void readwriteDAT();void chg(char*s)voidmain()char aN;system(“CLS“);printf(“Enter a strin

5、g:“);gets(a);printf(“The original string is:“);puts(a);chg(a);print f(“The string after modi fied:“);puts(a);readwriteDAT();void readwriteDAT()int i;char aN;unsigned char*P;FILE*rf,*wf;rf=fopen(“in61.dat“,“r“);wf=fopen(“out61.dat“,“w“);for(i=0;i10;i+)fgets(a,80,rf);P=strchr(a,/n);if(P) *P=0;chg(a);f

6、printf(wf,“%s/n,a);fclose(rf);fclose(wf);(分数:100.00)_正确答案:(void chg(char*s)int i,str; /*定义变量,保存字符串长度*/char ch; /*定义字符暂存变量*/str=strlen(s); /*求字符串的长度*/ch=*s; /*将第一个字符暂赋给 ch*/for(i=0;istr-1;i+) /*将字符依次左移*/*(s+i)=*(s+i+1);*(s+str-1)=ch; /*将第一个字符移到最后*/)解析:解析 本题考查用指针访问字符串的方法。首先,通过字符串处理函数(strlen()求出字符串的长度,保存第一个字符。然后,利用一个 for 循环将字符串依次左移一位。最后,将保存的第一个字符移到最后。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 1382-2016 Timber structures - Test methods - Withdrawal capacity of timber fasteners German version EN 1382 2016《木结构 试验方法 木制紧固件的抗拔出力 德文版本EN 1382-2016》.pdf DIN EN 1382-2016 Timber structures - Test methods - Withdrawal capacity of timber fasteners German version EN 1382 2016《木结构 试验方法 木制紧固件的抗拔出力 德文版本EN 1382-2016》.pdf
  • DIN EN 13820-2003 Thermal insulating materials for building applications - Determination of organic content German version EN 13820 2003《建筑物用保温材料 有机物含量的测定》.pdf DIN EN 13820-2003 Thermal insulating materials for building applications - Determination of organic content German version EN 13820 2003《建筑物用保温材料 有机物含量的测定》.pdf
  • DIN EN 13821-2003 Potentially explosive atmospheres - Explosion prevention and protection - Determination of minimum ignition energy of dust air mixtures German version EN 13821 20.pdf DIN EN 13821-2003 Potentially explosive atmospheres - Explosion prevention and protection - Determination of minimum ignition energy of dust air mixtures German version EN 13821 20.pdf
  • DIN EN 13823-2015 Reaction to fire tests for building products - Building products excluding floorings exposed to the thermal attack by a single burning item German version EN 1382.pdf DIN EN 13823-2015 Reaction to fire tests for building products - Building products excluding floorings exposed to the thermal attack by a single burning item German version EN 1382.pdf
  • DIN EN 13827-2004 Steel cord conveyor belts - Determination of the lateral and vertical displacement of steel cords German version EN 13827 2003《衬钢丝绳芯输送机皮带 钢丝绳芯水平和垂直位移的测定》.pdf DIN EN 13827-2004 Steel cord conveyor belts - Determination of the lateral and vertical displacement of steel cords German version EN 13827 2003《衬钢丝绳芯输送机皮带 钢丝绳芯水平和垂直位移的测定》.pdf
  • DIN EN 13828-2003 Building valves - Manually operated copper alloy and stainless steel ball valves for potable water supply in buildings - Tests and requirements German version EN .pdf DIN EN 13828-2003 Building valves - Manually operated copper alloy and stainless steel ball valves for potable water supply in buildings - Tests and requirements German version EN .pdf
  • DIN EN 1383-2016 Timber structures - Test methods - Pull through resistance of timber fasteners German version EN 1383 2016《木结构 试验方法 木制紧固件的楔入阻力 德文版本EN 1383-2016》.pdf DIN EN 1383-2016 Timber structures - Test methods - Pull through resistance of timber fasteners German version EN 1383 2016《木结构 试验方法 木制紧固件的楔入阻力 德文版本EN 1383-2016》.pdf
  • DIN EN 13830-2015 Curtain walling - Product standard German version EN 13830 2015《幕墙 产品标准 德文版本EN 13830-2015》.pdf DIN EN 13830-2015 Curtain walling - Product standard German version EN 13830 2015《幕墙 产品标准 德文版本EN 13830-2015》.pdf
  • DIN EN 13831-2007 Closed expansion vessels with built in diaphragm for installation in water English version of DIN EN 13831 2007-12《水中装置用安装在隔膜内的封闭式膨胀罐》.pdf DIN EN 13831-2007 Closed expansion vessels with built in diaphragm for installation in water English version of DIN EN 13831 2007-12《水中装置用安装在隔膜内的封闭式膨胀罐》.pdf
  • 相关搜索

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

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