题目内容
下列给定程序中,函数fun()的作用是:将字符串tt中的小写字母都改为对应的大写字母,其他字符不变。例如,若输入“edS,dAd”,则输出“EDS,DAD”。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <stdio.h>
include <string.h>
include <conlo.h>
/*************found*************/
char fun(char tt[ ])
{
int i;
for(i=0;tt[i];i++)
{
/*************found*************/
if((tt[i]>='A')&&(tt[i]<='2'))
tt[i]-=32;
}
return(tt);
}
main()
{
int i;
char tt[81];
clrscr();
printf("\nPlease enter a string:");
gets(tt);
printf("\nThe result string iS:/n%s", fun(tt));
}
查看答案
搜索结果不匹配?点我反馈
更多问题