# ASCII

This topic is 3671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have yet another exercise that deals with ASCII Write a program that outputs every character in the extended ASCII character set in the range [33, 255]. Note that we omit characters from [0, 32] since they are special command characters. (Hint: Recall that characters are represented by the char and unsigned char types, so simply loop through each possible value—33-255—and output it.) Your program’s output should look like the following: 33: ! 34: " 35: # 36: \$ 37: % 38: & 39: ' 40: ( 41: ) 42: * 43: + 44: , 45: - 46: . 47: / 48: 0 49: 1 50: 2 51: 3 52: 4 53: 5 54: 6 55: 7 56: 8 57: 9 58: 63: ? 64: @ 65: A 66: B 67: C 68: 73: I 74: J 75: K 76: L 77: M 78: N 79: O 80: P 81: Q 82: R 83: S 84: T 85: U 86: V 87: W 88: X 89: Y 90: Z 91: [ 92: 93: ] 94: ^ 95: _ 96:  1 113: q 114: r 115: s 116: t 117: u 118: v 119: w 120: x 121: y 122: z 123: { 124: | 125: } 126: ~ 127: ⌂ 128: Ç 129: ü 130: é 131: â 132: ä 133: à 134: å 135: ç 136: ê 137: ë 138: è 139: ï 140: î 141: ì 142: Ä 143: Å 144: É 145: æ 146: Æ 147 153: Ö 154: Ü 163: ú 164: ñ 165: Ñ 166: ª 167: º 168: ¿ 169: ⌐ 11 193: ┴ 194: 203: ╦ 204: ╠ 205: ═ 206: ╬ 207: ╧ 208: ╨ 209: ╤ 210: 213: ╒ 214: ╓ 215: ╫ 216: ╪ 217: ┘ 218: ┌ 219: █ 220: ▄ 221: ▌ 222: 223: ▀ 224: α 225: ß 226: Γ 227: π 228: Σ 229: σ 230: μ 231: τ 232: 233: Θ 234: Ω 235: δ 236: ∞ 237: φ 23 243: ≤ 244: ⌠ 245: ⌡ 246: ÷ 247: ≈ 248: ° 249: · 250: · 251: 253: ² 254: ■ 255: Press any key to continue anyways I know how to do the program I just don't exactly know how to get ASCII what code do I put in to generate ASCII, totally confused on that part. So if anyone could help me out that would be awesome!

##### Share on other sites
try the following piece of code and think about what it does:

#include <iostream>int main() {    char c = 40;    std::cout << c;}`

(Since your question looks like homework im not posting a more complete answer, sorry)

##### Share on other sites
Ooooh haha okay I get it now. Thanks bro!

##### Share on other sites
Actually I'm stuck on the looping part. It loops fine but the problem is it doesnt stop looping it like resets on it's own. It prints out all of em but since it likes to reset once i guess it hits 255 it does. And then the only way to close the program is to go into the task manager and close the proccess down and if u dont close it down it keeps looping and looping and beeping and beeping. So I hope someone can help me on that bit.

##### Share on other sites
You might get more help if you post your code. Just a thought...

##### Share on other sites
You're probably doing something like this:

for (unsigned char c = 32; c < 256; ++c) { .... }

Then you get overflow, because (unsigned char) (255 + 1) == 0.

##### Share on other sites
Yeah. Replace that with:

for (unsigned char c = 32; c != 0; ++c) { .... }