C语言实现统计字符串单词数
C语言实现统计字符串单词数
发布时间:2016-12-28 来源:查字典编辑
摘要:字符串单词数.c#include#defineBUFFERSIZE1024intmain(){charstring[BUFFERSIZE];...

字符串单词数.c

#include<stdio.h> #define BUFFERSIZE 1024 int main() { char string[BUFFERSIZE]; int i,count=0,word=0; char c; gets(string) ; for(i=0;(c=string[i])!='';i++) { if(c==' ') word=0; else if(word==0) { word=1; count++; } } printf("%d n",count); }

以上所述就是本文的全部内容,希望大家能够喜欢。

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新C语言学习
热门C语言学习
编程开发子分类