In what way is it not working?
Also:
Code:
data *dataPtr;
...
dataPtr = new data(rand() % 1000000);
You are actually leaking memory here, since each new element is copied into the hash table from the pointer, and the allocated memory never gets deleted.
There is no reason to use a pointer for this in the first place.
Technically, it is also not a 6-digit number - it MAY be a 6-digit number, but it is not guaranteed - your random number may be 1, 53, 3712 or 67189 - all of which are NOT 6 digits long - there is a 10% chance of the number being shorter than 6 digits. I don't think that REALLY matters, but still that's what your problem description says you should do, and you are not doing that.
Code:
// initialise the random number generator
srand(1);
I take it you actually WANT to have the same set of random numbers for each time you run the code? If so, there's really no reason to call srand() at all - there is a default constant seed that is used if you don't call srand(). There is nothing WRONG with calling srand() like this, it just serves no genuine purpose.
Code:
for (count=1; count<=SIZE;) {
....
count++;
}
Why not:
Code:
for (count=1; count<=SIZE;count++) {
....
}
(You may also want to move the variable declaration into the loop, as count is not used outside of the loop - at least not right now).
--
Mats