我不知道为什么这个代码不打破while循环:似乎无法打破碰撞while循环,哈希
int table_size = 953;
store hash_table[953];
for(int i = 0; i < table_size; i++)
hash_table[i].count = 0;
//bunch of stuff to get hash value here
while(hash_table[hashNum].data != pString || hash_table[hashNum].count != 0){
hashNum++;
if(hashNum > table_size)
hashNum = 0;
cout << hash_table[hashNum].count;
// to check the value of the count in the array, it IS 0, thus should have broken the loop
}
@ kingcong3:在''&&重视。目前,你的代码说“如果其中任何一个都是真的,继续下去”。相反,用&&'表示“如果其中任何一个都是错误的,停止”。 – Smashery 2011-05-11 04:36:17