C 言語は完全なコードを実現します。文字行を入力し、その中の単語の数を数え、各単語をスペースで区切ります。スペースの数は複数にすることができます...

#include<stdio.h> int main() { char str[200]; int count=0; printf("文字列を入力してください: ");gets(str); for(int i=0;str[ i] !='\0';i++) { if(str[i]==' ') count++; } printf("単語数: %d\n",count+1); return 0; }

おすすめ

転載: blog.csdn.net/weixin_42601547/article/details/129573208
おすすめ