I have a assignment where I need to take a 7 digit input (a phone number) and check if it's found in the digits of pi. The digits of pi are stored in a supplied space separated text file. It seems reasonably straightforward: break the input into an array, read the digits of pi into an array, and check if a match is found. Long story short, I got the program working to my satisfaction. We were supplied text documents with the digits of pi in multiples of 10, 100, and so on up to 1 million digits. My program works up to 100,000 digits. But for whatever reason, on the 1 million digit file, it crashes with a generic windows error. I have no information on why it crashes and no error message is given (except the generic "a problem caused this program to stop working" message).
Noting that limits on the assignment state I cannot use any object-orientated code except for cin, cout, and the file stream objects (this limitation is because we've yet to get into classes and they don't want us using functions without knowing how they work).
Anyway, I'm looking for insight as to why the program is crashing. I'm using long ints on every variable that should need them (including counters and function returns), which should be sufficient, since they can go up to roughly 2 billion and there should not be any numbers larger than a million here.
Thanks for any help. I've been at this the past few hours with no success.
const long int numberOfDigits = 1000000;
int digitsOfPi[numberOfDigits];