⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.cpp

📁 《c++ 实践之路》光盘中的源代码
💻 CPP
字号:
// Bartosz Milewski (c) 2000
#include "HTab.h"
#include <iostream>
#include <cstring>

char const * strTab [] = { "zero", "one", "two", "three" };

int main ()
{
	{
		HTable tab (3);
		int count = sizeof (strTab) / sizeof (char const *);
		for (int i = 0; i < count; ++i)
			tab.Add (strTab [i], i);
	}
	HTable tab (3);
	int count = sizeof (strTab) / sizeof (char const *);
	for (int i = 0; i < count; ++i)
		tab.Add (strTab [i], i);
	tab.Add ("four", 4);
	for (int i = 0; i < count; ++i)
	{
		char const * str = strTab [i];
		for (HTable::Seq seq (tab, str); !seq.AtEnd (); seq.Advance ())
		{
			if (std::strcmp (str, strTab [seq.GetValue ()]) == 0)
				std::cout << "Found " << str << " with value " << seq.GetValue () << std::endl;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -