Hi all,
First of all I should say that I am attempting the following using MFC.
I am trying to find the lowest scoring object in an array of objects called LineArray. Whenever a low score is found it is tested against all the other scores. If its position in the array is noted so that it can be copied back in later.
the code for the function is below
Code:
void FindTenBest(CLine LineArray[])
{
int number1 =5000; //lowest cost of line
int number2 =5000; //next lowest cost of line
int number3 =5000; //next lowest cost of line
int number4 =5000; //next lowest cost of line
int number5 =5000; //next lowest cost of line
int number6 =5000; //next lowest cost of line
int number7 =5000; //next lowest cost of line
int number8 =5000; //next lowest cost of line
int number9 =5000; //next lowest cost of line
int number10 =5000; //next lowest cost of line
for(int i=10;i<1010;i++)
{
if(LineArray[i].m_Cost<number1)
{
number10 = i;
continue;
}
if(LineArray[i].m_Cost<number2)
{
number9 = i;
continue;
}
if(LineArray[i].m_Cost<number3)
{
number8 = i;
continue;
}
if(LineArray[i].m_Cost<number4)
{
number7 = i;
continue;
}
if(LineArray[i].m_Cost<number5)
{
number6 = i;
continue;
}
if(LineArray[i].m_Cost<number6)
{
number5 = i;
continue;
}
if(LineArray[i].m_Cost<number7)
{
number4 = i;
continue;
}
if(LineArray[i].m_Cost<number8)
{
number3 = i;
continue;
}
if(LineArray[i].m_Cost<number9)
{
number2 = i;
continue;
}
if(LineArray[i].m_Cost<number10)
{
number1 = i;
continue;
}
}
LineArray[0] = LineArray[number1]; //store them in the array
LineArray[1] = LineArray[number2]; //store them in the array
LineArray[2] = LineArray[number3]; //store them in the array
LineArray[3] = LineArray[number4]; //store them in the array
LineArray[4] = LineArray[number5]; //store them in the array
LineArray[5] = LineArray[number6]; //store them in the array
LineArray[6] = LineArray[number7]; //store them in the array
LineArray[7] = LineArray[number8]; //store them in the array
LineArray[8] = LineArray[number9]; //store them in the array
LineArray[9] = LineArray[number10]; //store them in the array
}
The first ten places in the array are held for the lowest scoring ones. Otherwise 1000 other objects are created (10-1010). And these are the ones to be checked. The problem is that without the continue statement the lowest scoring object occupies the entire first ten. However when i use the continue statement and run the program it causes the error screen to appear. The error it would seem is:
Code:
oaded 'C:\WINDOWS\SYSTEM32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\kernel32.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\SYSTEM32\MFC42D.DLL'
Loaded symbols for 'C:\WINDOWS\SYSTEM32\MSVCRTD.DLL'
Loaded 'C:\WINDOWS\SYSTEM32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\rpcrt4.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\SYSTEM32\MFCO42D.DLL'
Loaded 'C:\WINDOWS\SYSTEM32\uxtheme.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM32\apphelp.dll', no matching symbolic information found.
The thread 0x33C has exited with code 0 (0x0).
The thread 0x794 has exited with code -1073741819 (0xC0000005).
This has no meaning to me whatsoever. I have tried running the program only up until i<1000; so it can't be that its running out of bounds with the array. I'm really stuck as to what it means. As ever any help would be greatly appreciated.
Many thanks
Dylan