hi,
What is the value of the following expression:
'g'-'a'+'A'
thanks
hi,
What is the value of the following expression:
'g'-'a'+'A'
thanks
1) dont you have a compiler to test it
2) learn the ASCII table or have an ASCII table in handy
well once again i am bored
Code:char x = 'g'-'a'+'A'; cout << x << endl; //hmm it should output 'G' or 71 in ASCII
nextus, the samurai warrior
You shouldn't need an ascii table.
All lowercase letters are consecutive and all uppercase letters are consecutive so a lower case letter minus lowercase a will give you the offset in the alphabet (a is 0, b is 1 ... z is 25). So adding the offset to capital A will give you the capital version of the letter.