I have been provided a function with certain perimeters that I must use. When I run the code I get "Unhandled exception at 0x0020129d in LabShell.exe: 0xC0000094: Integer division by zero." But I don't see whee I am dividing by zero.
Any help would be cool.
void Hash(int *dta, int n, int &counter, int *&HashTable, int &TableSize, int swch)
{
int m = 1; // m starts at zero for each new data element.
// index is the spot where the data wants to go but if it can't I have have to increment m in a while loop and inset x into HashTable[ index ]
int index = 0;
for ( int pass = 0; pass < 3; pass++ ) // this is the outer loop
{
for( int i = 0; i < n; i++ )
{
int x = dta[i];
switch( swch )
{
case 0:
{
HashTable[ index ] = ( dta[ i ] % TableSize + m ) % TableSize;
counter++;
}
break;
case 1:
{
HashTable[ index ] = ( dta[ i ] % TableSize + m * m ) % TableSize;
counter++;
}
break;
case 2:
{
HashTable[ index ] = ( dta[ i ] % TableSize + m * ( R - dta[ i ] % R ) % TableSize );
counter++;
}
break;
};
}
}
return;
}