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.

2
  • @incBrain Thank you, it worked! Should I delete the post? Commented Jun 11, 2016 at 1: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 :) Commented Jun 11, 2016 at 1:35

1 Answer 1

1

You are right on this: 6-18 = -12

When I divide: -12/26 = 0.46

With modulus = 4

I Hope this help you.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.