#include<stdio.h> #include<string.h> #include<math.h> #include<malloc.h> int main(){ char a[100]; while (gets(a,100) != NULL) { int n = strlen(a); for (int i = 0;i <= n - 4;i++) { if (a[i] == 's' || a[i] == 'S') { if (a[i + 1] == 'a' || a[i + 1] == 'A') { if (a[i+2] == 'l' || a[i+2] == 'L') { if (a[i+3] == 't' || a[i+3] == 'T') { printf("%s\n", a); break; } } } } } } } /* Main.c: In function 'main': Main.c:8:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] while (gets(a,100) != NULL) { ^ Main.c:8:9: error: too many arguments to function 'gets' while (gets(a,100) != NULL) { ^ In file included from Main.c:1:0: /usr/include/stdio.h:638:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^ */ |
Double click to view unformatted code.