ASCII or Unicode

Sorry about the basic questions lately I've been taken quite a few steps back to make me a better programmer,so I was wondering what is going on here I looked up the ascii table and if I add 32 to a lower case 'a' it should then be a 'A',but that doesn't seem to be the case so I decided to increment my char by one and it indeed did print 'b' which is what I was expecting.so what is going on here isn't adding 32 to a lower supposed to turn it into upper instead I get crazy characters printed out

1
2
3
4
5
6
  char test = 'a';
    cout << test << endl;
    test++;
    cout << test << endl;
    test += 32;
    cout << test << endl;


here is the output

 a
b
é
Last edited on
Take a look at this page:
http://www.asciitable.com
as you can see, your code has no mistake with the output, it is that you just misunderstood the ASCII table.

PS: the code for "A" is actually the code for "a" -32, not +32 (or +33)

...if I add 32 to a lower case 'a' it should then be a 'A', ...
You actually need to extract 32 from the 'a' :)
Last edited on
wow your right time for me to take a break if I'm making mistakes like that lol
Topic archived. No new replies allowed.