题目内容:
下列给定程序中,函数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(1=0;str[1];I++)
//****found****
{
if(('A'<=str[I]||(str[I]<='Z'))
str[1]+=32;)
return(str);
}
void mare()
{
chin str[81];
syslem("CLS");
printf("\nPlease enter a string:");
gets(str);
printf("\nThe result string is:\n%s\n",proc
(str));
}
参考答案:【答案仅供学习,请勿对照自行用药等】
答案解析: