Thread: Count the letters of a string.

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    9

    Count the letters of a string.

    How do you check a line of text using the cin.getline function and count the occurences of each letter of the alphabet.

    thanks for your help

  2. #2
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125

    Red face

    After you got the string you want to check ( doesn't matter what you were using to get it), you can check it char by char from the start of the string to the end and count every time you run into the char you are looking for.
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please check my C++
    By csonx_p in forum C++ Programming
    Replies: 263
    Last Post: 07-24-2008, 09:20 AM
  2. Replies: 26
    Last Post: 11-30-2007, 03:51 AM
  3. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  4. problems with overloaded '+' again
    By Brain Cell in forum C++ Programming
    Replies: 9
    Last Post: 04-14-2005, 05:13 PM
  5. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2003, 12:03 AM