0

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.

Nicholas Johnson
  • 932
  • 2
  • 11
  • 33

1 Answers1

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