填空题

下列给定程序中函数fun的功能是:将tt所指字符串中的小写字母全部改为对应的大写字母,其他字符不变。
例如,若输入“Ab,cD”,则输出“AB,CD”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<conio.h>
#inctude<stdio.h>
#include<string.h>
char*fun(char tt[])

int i;
for(i=0;tt[i];i++)
/*********found*********/
if((tt[i]>=’a’)||(tt[i]<=’z’))
/*********found*********/
tt[i]+=32;
return(tt);

void main()

char tt[81];
printf("\nPlease enter a string:");
gets(tt);
printf("\nThe result string is:%s\n",fun(tt);

【参考答案】

(1)错误:if((tt[i]>=’a’)||(tt[i]<=’z’))
正确:if((tt[i]>=’a’)......

(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)