当前位置: 首页>>代码示例>>C++>>正文


C++ Hash::showStructure方法代码示例

本文整理汇总了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");
}
开发者ID:unseenshadow2,项目名称:Data_Structures_and_Algorithms,代码行数:78,代码来源:main.cpp


注:本文中的Hash::showStructure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。