How to display ASCII characters on C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cl2020
    New Member
    • May 2010
    • 2

    How to display ASCII characters on C++

    More specifically, in the input code, how can you display all of the displayable ASCII characters with codes in the range 32 to 255 and also include display 16 ASCII characters per line, which will display in the program output?
    Last edited by cl2020; May 13 '10, 04:05 AM. Reason: - does not understand actually.
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    So am I right, you want an output like this:
    Code:
    " " 32,"!"33,"""34,.........."0"48
    "1"49..........................."A"65//and so on ?
    Well the part in inverted commas should be OK. How would you write the code to output the ASCII code numbers? Use the mod % operator to limit the line length to 16 units of character data in a for loop.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      Use isprint to confirm the character is printable so you don't mess up your display by sending control characters to it. Common practice is to print a period (.) for nonprintable characters.

      Have you written any code yet?

      Comment

      Working...