Outputting ASCII characters?

This is a discussion on Outputting ASCII characters? within the C++ Programming forums, part of the General Programming Boards category; How would I go about outputing a character using its ascii character? i.e...I have to make a frequency array of ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    162

    Outputting ASCII characters?

    How would I go about outputing a character using its ascii character? i.e...I have to make a frequency array of all the ascii characters in a given text file....so, after when displaying the results, i would do a for loop to go throughout the list, but how would i actaully output each character?

    Code:
    for (int i = 0; i < 256; i++)
      cout << ??? << endl;

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    cout << (char)i << endl;

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    162
    Thank you much my lord.

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>Thank you much my lord.

    Wrong century.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  2. Replies: 11
    Last Post: 03-24-2006, 10:26 AM
  3. Replies: 5
    Last Post: 12-22-2004, 04:46 PM
  4. ascii characters video displaying on tv screen
    By deian in forum C Programming
    Replies: 6
    Last Post: 10-12-2004, 09:46 PM
  5. Printing extended ASCII characters
    By Jonny M in forum C Programming
    Replies: 2
    Last Post: 03-01-2002, 09:12 AM

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