为方便广大考生查找考试辅导习题及更好的学习。网校(www.examzz.com)特提供2013年计算机二级C语言考试上机预测题(包括填空题、改错题、编程题),作为参考希望能帮到各位考生。
填空题
请补充fun函数,该函数的功能是字符串tt中的大写字母都改为对应的小写字母,其它字符不变.
例如,若输入"Are you come from Sichuan?则输出","are you come from sichuan?"
注意:部分源程序给出如下。
仅在横线上填入所编写的若干表达式或语句,勿改动函数中的其他任何内容。
试题程序:#include <stdio.h>
#include <string.h>
#include <conio.h>
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