I have the encryption code working so I commented out the functions in main. I'm trying to do a decryption using a^-1(x-b) with the code you see but I get all As when I enter a word like hello. I then tested it with just one letter and still got an A.
I kinda understand what you are saying and I thought that was maybe an issue too. However, I just briefly looked up ways to fix it and I tried changing it so it said float inverse = 1/a and then plugged the word inverse in place of the 1/a on line 28. However it didn't like it as the % only works with int types. One site suggested somebody use fmod but I see that gives back exact values in decimal but I don't think I want that?
You can see the 1/a produces an uncatched error which is processed further.
There exist algorithms which trace the "error" up until they reach an threshold to either round them up or down. Sorry, I forgot the name of this class of algorithms, but the Bresenham algorithm for smooth line drawing is a fine example.
I mis-understood the formula for decoding. So now it's fixed and I assume my error is in the wrap around portion so it doesn't go out of bounds. If you type in the word hello, the encryption is ITCCR, which is correct. However, when you type in the word ITCCR the decode function outputs PMTTW.