How to count the words in sentence ?

This is a discussion on How to count the words in sentence ? within the C Programming forums, part of the General Programming Boards category; How can we count the number of word in sentence without using <string.h> library ? Example : My name is ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    18

    Question How to count the words in sentence ?

    How can we count the number of word in sentence without using <string.h> library ?
    Example :
    My name is SeA!
    The sentence got 4 words there, how can we count it ?

  2. #2
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,156
    Look at each character
    If a nonspace follows a space, increment the word counter.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what would I use to count number of words
    By s_jsstevens in forum C Programming
    Replies: 42
    Last Post: 08-11-2009, 07:14 AM
  2. bintree and count (withouth using template)?
    By cubimongoloid in forum C++ Programming
    Replies: 7
    Last Post: 05-24-2009, 06:22 AM
  3. input question
    By piyush_v in forum C Programming
    Replies: 9
    Last Post: 04-12-2007, 07:09 AM
  4. count only lines of code...
    By flightsimdude in forum C Programming
    Replies: 13
    Last Post: 09-23-2003, 07:08 PM
  5. words count
    By arlenagha in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2003, 08:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21