Salutations! I am having a lot of trouble trying to create a program that will test the validity of a user entered password. Below is the criteria of the test:
1. The password must be 6 digits long entered as a single integer (assume no leading zeros are entered – for example: 002345 is only 4 digits for our purposes).
2. All the digits in the number have to be unique.
3. The sum of the digits must be a prime number.
4. The largest digit (n) “choose” the left-most digit (k) must be even—for example: in 645923, the largest digit is 9 and the left-most is 6.
I am trying to use digit extraction and integer devision to accomplish this but I do not understand it yet (im a student).
I believe I could use something like
digit = (num % 10) num = num/10 at least for the first digit? Also I can compute basic "n choose k" situations by hand but I could use some guidence for coding.
* I am using CodeBlocks with the GNU Compiler and iostream library *
Any advice is appreciated!!