本文整理汇总了C++中Hash::showStructure方法的典型用法代码示例。如果您正苦于以下问题:C++ Hash::showStructure方法的具体用法?C++ Hash::showStructure怎么用?C++ Hash::showStructure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hash
的用法示例。
在下文中一共展示了Hash::showStructure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Hash<char> toTest (hasher, 10);
// isEmpty() test
cout << "\nisEmpty() Test" << endl;
cout << "isEmpty(): " << toTest.isEmpty() << endl;
cout << "isFull(): " << toTest.isFull() << endl;
toTest.showStructure();
// insert() test
cout << "\ninsert() Test" << endl;
for (char c = '0'; c <= 'z'; c++)
{
toTest.insert(c);
}
toTest.showStructure();
// isFull() test
cout << "\nisFull() Test" << endl;
cout << "isEmpty(): " << toTest.isEmpty() << endl;
cout << "isFull(): " << toTest.isFull() << endl;
// remove() and retrieve() test
cout << "\nremove() and retrieve() Test" << endl;
char rtest = ' ';
cout << "remove(3): " << toTest.remove(3) << endl;
bool rreturn = toTest.retrieve(3, rtest);
cout << "retrieve(3, rtest): " << rreturn << " | rtest = " << rtest << endl;
toTest.showStructure();
// clear() test
cout << "\nclear() Test" << endl;
toTest.clear();
toTest.showStructure();
// isEmpty() test
cout << "\nisEmpty() Test" << endl;
cout << "isEmpty(): " << toTest.isEmpty() << endl;
cout << "isFull(): " << toTest.isFull() << endl;
toTest.showStructure();
// Int test version
Hash<int> testTwo(hasher_two, 20);
cout << "\n\nTesting with ints:" << endl;
// insert() test
cout << "\ninsert() Test" << endl;
for (int i = 1; i <= 115; i++)
{
testTwo.insert(i);
}
testTwo.showStructure();
// isFull() test
cout << "\nisFull() Test" << endl;
cout << "isEmpty(): " << testTwo.isEmpty() << endl;
cout << "isFull(): " << testTwo.isFull() << endl;
// remove() and retrieve() test
cout << "\nremove() and retrieve() Test" << endl;
cout << "remove(3): " << testTwo.remove(3) << endl;
int itest;
bool ireturn = testTwo.retrieve(3, itest);
cout << "retrieve(3, rtest): " << ireturn << " | rtest = " << itest << endl;
testTwo.showStructure();
// clear() test
cout << "\nclear() Test" << endl;
testTwo.clear();
testTwo.showStructure();
system("pause");
}