Accepted
/in/foo.c: In function 'main': /in/foo.c:6:7: warning: 'gets' is deprecated [-Wdeprecated-declarations] gets(str) ; ^~~~ In file included from /in/foo.c:1:0: /usr/include/stdio.h:640:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ /tmp/ccbh8AOn.o: In function `main': foo.c:(.text.startup+0xc): warning: the `gets' function is dangerous and should not be used.
代码
#include <stdio.h>
int main()
{
void cpy(char s[],char c[]);
char str[80],c[80];
gets(str) ;
cpy(str,c);
printf("%s",c);
return 0;
}
void cpy(char s[ ],char c[ ])
{
int i,j;
for(i=0,j=0;s[i]!='\0';i++)
if(s[i]=='a'||s[i]=='A'||s[i]=='e'||s[i]=='E'||s[i]=='i'||s[i]=='I'||
s[i]=='o'||s[i]=='O'||s[i]=='u'||s[i]=='U')
{
c[j]=s[i];
j++ ;
}
c[j]='\0';
}