码迷,mamicode.com
首页 > 其他好文 > 详细

循环-06. 统计一行文本的单词个数

时间:2014-07-26 00:28:06      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   strong   io   2014   re   

 1 /**
 2  * Main.c
 3  * 循环-06. 统计一行文本的单词个数
 4  *  Created on: 2014年7月25日
 5  *      Author: Boomkeeper
 6  ******测试通过************
 7  */
 8 
 9 #include <stdio.h>
10 
11 int main(){
12     char input,b= ;
13     int count=0;
14 
15     while((input=getchar())!=\n){
16 //        printf("%c\n",input);
17         if(input!=  && b== )
18             count++;
19         b=input;
20     }
21 
22     printf("%i\n",count);
23 
24     return 0;
25 }

参考来源:

http://tieba.baidu.com/p/3078959002

题目链接:

http://pat.zju.edu.cn/contests/basic-programming/%E5%BE%AA%E7%8E%AF-06

循环-06. 统计一行文本的单词个数,布布扣,bubuko.com

循环-06. 统计一行文本的单词个数

标签:style   blog   http   color   strong   io   2014   re   

原文地址:http://www.cnblogs.com/boomkeeper/p/C6.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!