我不知道爲什麼這個代碼不打破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