填空题
1. 请补充函数proc(),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符串。
例如,若输入“everyONE!”,则输出“every“。
注意:部分源程序如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void proc(char*str)
{
int i=0;
char *p=str;
while(______)
{
if(*p>='a'&&*p<='z')
{
str[i]=*p;
______;
}
p++;
}
str[i]=______;
}
void main()
{
char str[80];
system("CLS");
printf("\nEnter a string:");
gets(str);
printf("\n\nThe string is:%s\n",str);
proc(str);
printf("\n\nThe string of changing is:%s\n",str);
}