** Edit added some more info into a reply **

** Edit, I think I got it fixed, now, thanks for reading **

First off, before I start. I am writing this program for a college class, there for I don't want any suggestions on how to write the program better, I'm only asking one specific question.

"Why is it stopping where it is?"

If you have a suggestion or answer that doesn't pertain to that question, then it's information I don't want to know. This is an assignment and I don't want anyone else doing the whole thing for me.

This objective of this assignment is to write a program to find all six digit cyclic numbers. If you don't know what a cyclic number is, it's a number that when multiplied by any number (in the case of the assignment, only through 6) will produce a number with the same six digits.

For example:

123456 * 2 = 253461

123456 * 3 = 365124

123456 * 4 = 451632

... and so on through six. These are not correct calculations, it's just an example.

Now that we've covered what cyclic numbers are, here is my program.

There are some lines of code in there that were for debugging purposes only, so I can see what is going on. They aren't permemant.Code:#include <iostream.h> int main() { long sixDigitNum = 100000; long digitMutlip; int digiValue[6][6]; // Array[mulitiplier][digit] int numAppear[6][10]; // Array[mulitiplier][number] int mult = 0; int number = 0; cout << "Checking for Cyclic Numbers. Please Wait..." << endl; while (sixDigitNum <= 166666) { // Process 1: Parsing Digits do { digitMutlip = sixDigitNum * (mult + 1); digiValue[mult][5] = digitMutlip / 100000; digiValue[mult][4] = (digitMutlip % 100000) / 10000; digiValue[mult][3] = (digitMutlip % 10000) / 1000; digiValue[mult][2] = (digitMutlip % 1000) / 100; digiValue[mult][1] = (digitMutlip % 100) / 10; digiValue[mult][0] = (digitMutlip % 10); mult++; } while (mult <= 5); // End Process 1 mult = 0; cout << "Parsed Digits" << endl; cout << sixDigitNum << endl; // Process 2: Totaling Number Appearence do { if (digiValue[mult][5] == number) numAppear[mult][number] = numAppear[mult][number] + 1; if (digiValue[mult][4] == number) numAppear[mult][number] = numAppear[mult][number] + 1; if (digiValue[mult][3] == number) numAppear[mult][number] = numAppear[mult][number] + 1; if (digiValue[mult][2] == number) numAppear[mult][number] = numAppear[mult][number] + 1; if (digiValue[mult][1] == number) numAppear[mult][number] = numAppear[mult][number] + 1; if (digiValue[mult][0] == number) numAppear[mult][number] = numAppear[mult][number] + 1; if (number == 9) { number = 0; mult++; } else number++; } while (mult <= 5); // End Process 2 mult = 0; number = 0; cout << "Totaled Appearences" << endl; // Process 3: Comparing mults do { if (numAppear[mult][number] == numAppear[mult + 1][number] && numAppear[mult][number] == numAppear[mult + 2][number] && numAppear[mult][number] == numAppear[mult + 3][number] && numAppear[mult][number] == numAppear[mult + 4][number] && numAppear[mult][number] == numAppear[mult + 5][number] && number < 9) number++; else if (numAppear[mult][number] == numAppear[mult + 1][number] && numAppear[mult][number] == numAppear[mult + 2][number] && numAppear[mult][number] == numAppear[mult + 3][number] && numAppear[mult][number] == numAppear[mult + 4][number] && numAppear[mult][number] == numAppear[mult + 5][number] && number == 9) { cout << "Found Cyclic Number: " << sixDigitNum << endl; number++; } else number = 10; } while (number <= 9); // End Process 3 cout << "Not Cyclic" << endl; sixDigitNum++; } cin.get(); return 0; }

Basically, what this code is doing is running through one number, then parsing the digits of the second number and stopping. Here is the output it's giving me.

Can anyone tell me why it's stopping at this point, and why sixDigitNum is coming out to 0 instead of 100001?Code:Checking for Cyclic Numbers. Please Wait... Parsed Digits 100000 Totaled Appearences Not Cyclic Parsed Digits 0

Thanks, any reply is appreciated.