#include<stdio.h> #include<string.h> void test(char s[]) { int i; for(i=0;i<strlen(s);i++) { if(s[i]=='s'||s[i]=='S') { if(s[i+1]=='a'||s[i+1]=='A') { if(s[i+2]=='l'||s[i+2]=='L') { if(s[i+3]=='t'||s[i+3]=='T') { puts(s); break; } } } } } } void main() { int i; char s[1000]; while(gets(s)) { test(s); } /* Main.c:27:6: warning: return type of 'main' is not 'int' [-Wmain] void main() ^ Main.c: In function 'main': Main.c:31:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] while(gets(s)) ^ Main.c:34:2: error: expected declaration or statement at end of input } ^ Main.c:29:6: warning: unused variable 'i' [-Wunused-variable] int i; ^ */ |
Double click to view unformatted code.