2011年计算机二级C语言上机操作题及答案(12)

2014-11-20 17:18:11 · 作者: · 浏览: 20

第12套


填空题


请补充fun函数,该函数的功能是字符串tt中的大写字母都改为对应的小写字母,其它字符不变.


例如,若输入"Are you come from Sichuan 则输出","are you come from sichuan "


注意:部分源程序给出如下。


仅在横线上填入所编写的若干表达式或语句,勿改动函数中的其他任何内容。


试题程序:#include


#include


#include


char *fun(char tt[])


{


int i;


for(i=0;tt[i];i++)


{


if((tt[i]>=’A’)&&(___1___))


tt[i] += ___2___;


}


return (___3___);


}


main()


{


char tt[81];


printf("\nPlease enter a string: ");


gets(tt);


printf("\nThe result string is: \n%s", fun(tt));


}


第1处填空:tt[i]<=’z’或’z’>=tt[i]


第2处填空:32或’a’-‘A’


第3处填空:tt


编辑特别推荐: