This is hopefully a really simple issue that I am overlooking. I am writing in C++ on Qt and I am working on ciphers. I have to use the %26
in order to get them working. I tested this: qDebug() << (6-18)%26;
and according to the internet and math, it should produce me with the number 14, right? No. I get -12 which is what 6-18 is, so I don't know if the modulo isn't being applied of what. Any help is greatly appreciated.
Asked
Active
Viewed 1,884 times
0

Nicholas Johnson
- 1,012
- 2
- 12
- 35
-
@incBrain Thank you, it worked! Should I delete the post? – Nicholas Johnson Jun 11 '16 at 01:12
-
@NicholasJohnson You can delete it if you wish, or you can just leave it and it may be marked as a dupe, which might still help people searching for it in future :) – Tim Malone Jun 11 '16 at 01:35
1 Answers
1
You are right on this: 6-18 = -12
When I divide: -12/26 = 0.46
With modulus = 4
I Hope this help you.

mawel3712
- 26
- 2