I have isolated another error in my program.
It occurs in my dlist class.
I don't know how to explain it.
My dlist class uses a
bool digits[maxx];
with
const int maxx = 100;
and a variable
int length;
to traverse the bool array for indexing, setting, & displaying. display() for example looks like:
1 2 3 4 5 6 7 8 9 10
|
void dlist::display()
{
cout << endl;
for (int i = 0; i < length; ++i)
{
if (digits[i] == true)
cout << " " << i+1 << ", ";
}
cout << endl;
}
|
I think you get the idea.
Well the problem is this: I wanted to make sure that if someone were to resize the dlist, i.e. make it smaller, the values in the dlist above the new length would all be reset to false, in case of latter on if the dlist were to be enlarged again it wouldn't contain garbage data left over from before.
so my dlist:resize function looks like this:
1 2 3 4 5 6 7 8 9 10 11 12
|
void dlist::resize(const int & n)
{
if (n == -1) exit (-999);
if (n <= maxx)
length = n;
else return;
for (int i = n; i <= maxx; ++i)
if (containsN(i))
removeN(i);
return;
}
|
The problem seems to be occurring in here:
1 2 3 4 5 6 7 8
|
void dlist::removeN(const int & x)
{
cout << "x = " << x << endl;
digits[x-1] = false;
cout << "after digits[x-1] = false\n";
return;
}
|
It works fine up until x = about 36, at which point "after digits..." is never again printed to the screen and my program abruptly ends, with the following error message printed to the terminal screen from the codeblocks console runner:
Process returned -1073741819 (0xC0000005) execution time : 0.984 s
Press any key to continue.
|
With no other error messages or GPF's from windows.
Who can tell me what is causing this error?
Its another one the many issues driving me nuts after reimplementing my matrix class. It worked fine before. (Although I can't be sure if this particular issue arrose from me trying to fix another one of those issues...)
Thanks again for your help.