【计算机类职业资格】全国计算机二级C语言上机试题65+2015年及答案解析.doc

上传人:explodesoak291 文档编号:1329391 上传时间:2019-10-17 格式:DOC 页数:2 大小:32.50KB
下载 相关 举报
【计算机类职业资格】全国计算机二级C语言上机试题65+2015年及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】全国计算机二级C语言上机试题65+2015年及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、全国计算机二级 C语言上机试题 65+2015年及答案解析(总分:30.00,做题时间:90 分钟)1.给定程序中,函数 fun的功能是:将 a所指 43矩阵中第 k行的元素与第 0行元素交换。 例如,有下列矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 若 k为 2,程序执行结果为: 7 8 9 4 5 6 1 2 3 10 11 12 请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANK1.C中。不得增行或删行,也不得更改程序的结构! 给定源程序: #include #define N 3 #define M

2、4 /*found*/ void fun(int (*a)N, int _1_) int i,j,temp ; /*found*/ for(i = 0 ; i tj+1)。)解析:3.请编写一个函数 fun, 其功能是: 将 ss所指字符串中所有下标为奇数位置上的字母转换为大写(若该位置上不是字母, 则不转换)。 例如, 若输入“abc4EFg“,则应输出“aBc4EFg“。 注意: 部分源程序在文件 PROG1.C文件中。 请勿改动主函数 main和其它函数中的任何内容, 仅在函数 fun的花括号中填入你编写的若干语句。 给定源程序: #include #include void fun(

3、char *ss ) void main( void ) char tt51; printf( “/nPlease enter an character string within 50 characters:/n“ ); gets( tt ); printf( “/n/nAfter changing, the string/n /“%s/“, tt ); fun(tt) ; printf( “/nbecomes/n /“%s/“, tt ); NONO(); (分数:10.00)_正确答案:(void fun( char *ss ) char *p = ss ; int i = 0 ; wh

4、ile(*p) if(i % 2) p+ ; i+ ; return ss ; )解析:解题思路: 本题是考察考生在字符串指定位置上的字母转换为大写。给出的程序是由 i来控制字符串所在的位置,字符串指针 p是指向形参 ss,再使用 while循环语句对 p进行控制来判断字符串是否结束,在循环体中使用 if条件语句来判断位置 i是否为奇数且 p所指的当前字符是否为a至z的字母,如果满足这两个条件,则把该小写字母转换成大写字符,小写字母与大写字母的差是 32,所以只小写字母减去 32,即可得到该字母的大写字母,且转换后的字母仍存放到原字符串的位置上,转换结束后,最后通过形参 ss返回已转换后的字符串。

展开阅读全文
相关资源
猜你喜欢
  • ETSI TS 124 483-2018 LTE Mission Critical Services (MCS) Management Object (MO) (V15 2 0 3GPP TS 24 483 version 15 2 0 Release 15 Includes Diskette).pdf ETSI TS 124 483-2018 LTE Mission Critical Services (MCS) Management Object (MO) (V15 2 0 3GPP TS 24 483 version 15 2 0 Release 15 Includes Diskette).pdf
  • ETSI TS 124 484-2017 LTE Mission Critical Services (MCS) configuration management Protocol specification (V14 3 1 3GPP TS 24 484 version 14 3 1 Release 14 Includes Diskette)《长期演进技术.pdf ETSI TS 124 484-2017 LTE Mission Critical Services (MCS) configuration management Protocol specification (V14 3 1 3GPP TS 24 484 version 14 3 1 Release 14 Includes Diskette)《长期演进技术.pdf
  • ETSI TS 124 484-2018 LTE Mission Critical Services (MCS) configuration management Protocol specification (V15 3 0 3GPP TS 24 484 version 15 3 0 Release 15 Includes Diskette).pdf ETSI TS 124 484-2018 LTE Mission Critical Services (MCS) configuration management Protocol specification (V15 3 0 3GPP TS 24 484 version 15 3 0 Release 15 Includes Diskette).pdf
  • ETSI TS 124 501-2018 5G Non-Access-Stratum (NAS) protocol for 5G System (5GS) Stage 3 (V15 0 0 3GPP TS 24 501 version 15 0 0 Release 15).pdf ETSI TS 124 501-2018 5G Non-Access-Stratum (NAS) protocol for 5G System (5GS) Stage 3 (V15 0 0 3GPP TS 24 501 version 15 0 0 Release 15).pdf
  • ETSI TS 124 502-2018 5G Access to the 3GPP 5G Core Network (5GCN) via non-3GPP access networks (V15 0 0 3GPP TS 24 502 version 15 0 0 Release 15).pdf ETSI TS 124 502-2018 5G Access to the 3GPP 5G Core Network (5GCN) via non-3GPP access networks (V15 0 0 3GPP TS 24 502 version 15 0 0 Release 15).pdf
  • ETSI TS 124 503-2016 Digital cellular telecommunications system (Phase 2+) Universal Mobile Telecommunications System (UMTS) LTE TISPAN IP Multimedia Call Control Protocol based on.pdf ETSI TS 124 503-2016 Digital cellular telecommunications system (Phase 2+) Universal Mobile Telecommunications System (UMTS) LTE TISPAN IP Multimedia Call Control Protocol based on.pdf
  • ETSI TS 124 503-2017 Digital cellular telecommunications system (Phase 2+) (GSM) Universal Mobile Telecommunications System (UMTS) LTE TISPAN IP Multimedia Call Control Protocol ba.pdf ETSI TS 124 503-2017 Digital cellular telecommunications system (Phase 2+) (GSM) Universal Mobile Telecommunications System (UMTS) LTE TISPAN IP Multimedia Call Control Protocol ba.pdf
  • ETSI TS 124 503-2017 Digital cellular telecommunications system (Phase 2+) (GSM) Universal Mobile Telecommunications System (UMTS) LTE TISPAN IP Multimedia Call Control Protocol ba_1.pdf ETSI TS 124 503-2017 Digital cellular telecommunications system (Phase 2+) (GSM) Universal Mobile Telecommunications System (UMTS) LTE TISPAN IP Multimedia Call Control Protocol ba_1.pdf
  • ETSI TS 124 504-2015 Digital cellular telecommunications system (Phase 2+) Universal Mobile Telecommunications System (UMTS) LTE TISPAN PSTN ISDN simulation services Communication .pdf ETSI TS 124 504-2015 Digital cellular telecommunications system (Phase 2+) Universal Mobile Telecommunications System (UMTS) LTE TISPAN PSTN ISDN simulation services Communication .pdf
  • 相关搜索

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

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