I know this sounds like a very specific question, but I am making a key generator for a program, and one part of the key has seven digits that need to be a multiple of seven when added together. How do you achieve this?
I know this sounds like a very specific question, but I am making a key generator for a program, and one part of the key has seven digits that need to be a multiple of seven when added together. How do you achieve this?
Generate a random 6-digit number then choose the number for the 7th digit that makes the algorithm work.
See any example of how to use std::rand for generating the random digits.
Once you have generated the 7 numbers for the key. You could than try a %7. If the result is 0, than it mean that your number generated is a multiple of 7. If the result is not 0, than you just have to regenerate another key or add 1 to the last number until modulo 7 (%7) equal 0.