问答题
下列给定程序中,函数proc()的作用是:将字符串str中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入“abD,dFAD”,则输出“abd,dfad”。
请修改函数proc()中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
char*proc(char str[])
{
int I;
for(I=0; str[I]; I++)
//****found****
if(("A"<=str[I]||(str[I]<="Z"))
str[I]+=32; }
return(str);
}
void main()
{
char str[81];
system("CLS");
printf("/nPlease enter a string: ");
gets(str);
printf("/nThe result string is: /n%s/n", proc(str));
}