下列给定程序中,函数fun()的功能是:依次取出字符串中所有的字母,形成新的字符串,
问题:
下列给定程序中,函数fun()的功能是:依次取出字符串中所有的字母,形成新的字符串,并取代原字符串。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<conio.h>
void fun(char*S)
int i,j;
for(i=0,j=0;s[i]! =’\0’;i++)
/*************found************/
if((s[i]>=’A’&&s[i]<=’Z’)&&(s[i]>= ’a’&&S[i]<=’z’,))
s[j++]=s[i];
/*************found*************/
s[j]="\0";
main()
char item[80];
clrscr();
printf("\nEnter a string:");
gets(item);
printf("\n\nThe string is:\%s\n",item);
fun (item);
printf("\n\nThe string of changing
is:\%S\n",item);