Character frequency table

This is a discussion on Character frequency table within the C Programming forums, part of the General Programming Boards category; hey guys. I'm trying to develop a simple program which takes a line of characters entered by the user, and ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    1

    Character frequency table

    hey guys. I'm trying to develop a simple program which takes a line of characters entered by the user, and displays the total count of each character entered; as well as what percentage of the total count is attributed to each character. I only want to display the info for characters that were entered though, not every single character.

    I'm just wondering, what's the best way to format and/or what tools could I use to start developing this program. thanx

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > what tools could I use to start developing this program
    A text editor and a compiler is a good start.

    > what's the best way to format
    An array that stores a count of the characters that occured, ie

    Code:
    int freq[UCHAR_MAX - ' '] = {0};    /* more than enough for all the printable ascii characters, assumes ascii of course */
    
    /* go through the string you read and add the printable characters to the array (with isprint() from ctype.h), then carry on...
    just make sure you don't go out of bounds of the array */

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. frequency character counter
    By hasanah in forum C Programming
    Replies: 4
    Last Post: 04-15-2009, 02:28 AM
  2. get wide character and multibyte character value
    By George2 in forum C++ Programming
    Replies: 27
    Last Post: 01-27-2008, 05:10 AM
  3. Group Project Help/Volunteer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2007, 12:36 AM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. about program that counts a character frequency
    By Unregistered in forum C++ Programming
    Replies: 15
    Last Post: 04-23-2002, 02:21 PM

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