Loop-06. count the number of words in a line of text

Source: Internet
Author: User
1/** 2 * Main. C 3 * loop-06. count the number of words in a line of text 4 * created on: July 25, 2014 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}

Reference Source:

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

Question link:

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.