ascii minus a number C++
Converting lower & upper case ascii characters C++
So, I'm trying to do what is in that thread, except I want to go backwards
for ascii conversion (letters only) aka, if I gave the number 1.
b+1 = a
B+1 = A (capital becomes capital)
c+2 = a
z+1 = y
a+1 = z
int lower_add = ((letter - 'a' - input_int) % 26) +'a';
if ((lower_add -'a' - input_int) < 0)
lower_add = lower_add +26;
This is almost getting it, except there are some cases where b+1 will go
to some other non-letter ascii char.
No comments:
Post a Comment