last minute hashtable fixes
This commit is contained in:
parent
4882cd51fa
commit
262cbe637e
@ -210,7 +210,7 @@ void HashTable<T>::_reHash(int h(const T &key, int size)) {
|
|||||||
if (nHashAry[nIndex].getOccupied() != 1) {
|
if (nHashAry[nIndex].getOccupied() != 1) {
|
||||||
nHashAry[nIndex].setItem(aT);
|
nHashAry[nIndex].setItem(aT);
|
||||||
nHashAry[nIndex].setOccupied(1);
|
nHashAry[nIndex].setOccupied(1);
|
||||||
nHashAry[nIndex].setNumCollisions(i);
|
nHashAry[nIndex].setNumCollisions(j);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ void writeToFile(const HashTable<T> &hashTable, const string &filename, string v
|
|||||||
|
|
||||||
if (!outputFile.good()) {
|
if (!outputFile.good()) {
|
||||||
cout << "Error opening the output file: \"" << filename << "\"" << endl;
|
cout << "Error opening the output file: \"" << filename << "\"" << endl;
|
||||||
exit(EXIT_FAILURE);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputFile.flush();
|
outputFile.flush();
|
||||||
@ -252,6 +252,7 @@ void writeToFile(const HashTable<T> &hashTable, const string &filename, string v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cout << "Data written to file \"" << filename << "\".\n";
|
||||||
outputFile.close();
|
outputFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
main.cpp
1
main.cpp
@ -199,5 +199,4 @@ void handleFileOutput(HashTable<CPU> &hashTable, UndoManager<CPU> &undoManager)
|
|||||||
cin >> filename;
|
cin >> filename;
|
||||||
writeToFile(hashTable, filename, to_string);
|
writeToFile(hashTable, filename, to_string);
|
||||||
undoManager.clearUndoStack();
|
undoManager.clearUndoStack();
|
||||||
cout << "Data written to file \"" << filename << "\".\n";
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user