本文整理汇总了C++中hashtable::get2方法的典型用法代码示例。如果您正苦于以下问题:C++ hashtable::get2方法的具体用法?C++ hashtable::get2怎么用?C++ hashtable::get2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hashtable
的用法示例。
在下文中一共展示了hashtable::get2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menu
void menu()
{
int input = 0;
do
{
cout << endl;
cout << "Menu (Enter the number)" << endl;
cout << "1. Search." << endl;
cout << "2. Exit. " << endl;
cout << "User Entry: ";
cin >> input;
cout << endl;
}
while ((input != 1) && (input != 2));
if (input == 1)
{
string query;
int num_of_results = 0;
cout << "Enter your single-word query: ";
cin >> query;
//***start clock***//
clock_t start, finish;
double dur;
start = clock();
//*****************//
//hash query
HashFunction H;
int HashKey = H.Hash(query);
stack<string> result;
result = Table.get2(HashKey);
//print out results
cout << "Result(s): " << endl;
while (!result.empty())
{
cout << " " << result.top() << endl;
result.pop();
num_of_results++;
}
cout << "********************" << endl;
cout << num_of_results << " Results." << endl;
//***stop clock***//
finish = clock();
dur = (double)(finish - start);
dur /= CLOCKS_PER_SEC;
cout << "Search Time: " << scientific << dur << endl;
//****************//
menu();
}