#pragma warning(disable:4996) #include<stdio.h> #include<ctype.h> #include<string.h> #include<iostream> #include<stack> #include<time.h> using namespace std; /*test*/ //#define as '\x41' //int atoi(char s[]); //int strlen(char s[]); //void squeeze(char s[], char c); //void strcat(char s[], char t[]); //int bitcount(unsigned x); int main() { char str[10000]; gets_s(str); int num = 0, i=0; while (str[i] != '\0') { while (str[i] != ' '&&str[i] != '\0') i++; num++; while (str[i] == ' '&&str[i] != '\0') i++; } printf("%d", num); } /* Main.cc:1: warning: ignoring #pragma warning [-Wunknown-pragmas] #pragma warning(disable:4996) Main.cc: In function 'int main()': Main.cc:22:2: error: 'gets_s' was not declared in this scope gets_s(str); ^~~~~~ Main.cc:22:2: note: suggested alternative: 'gets' gets_s(str); ^~~~~~ gets */ |
Double click to view unformatted code.