#include <stdio.h> #include <string.h> #include <math.h> #include <ctype.h> int main() { char input[333]; gets(input); bool tag = true; int sum = 0; for(int i = 0, length = strlen(input); i < length; i ++) { if(isalpha(input[i]) && tag == true) { sum ++; tag = false; } else if(input[i] == ' ') { tag = true; } } printf("%d", sum); return 0; } /* Main.c: In function 'main': Main.c:8:2: warning: 'gets' is deprecated [-Wdeprecated-declarations] gets(input); ^~~~ In file included from Main.c:1: /usr/include/stdio.h:583:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ Main.c:9:2: error: unknown type name 'bool'; did you mean '_Bool'? bool tag = true; ^~~~ _Bool Main.c:9:13: error: 'true' undeclared (first use in this function); did you mean 'trunc'? bool tag = true; ^~~~ trunc Main.c:9:13: note: each undeclared identifier is reported only once for each function it appears in Main.c:15:10: error: 'false' undeclared (first use in this function); did you mean 'fabsl'? tag = false; ^~~~~ fabsl */ |
Double click to view unformatted code.