// From the software distribution accompanying the textbook // "A Practical Introduction to Data Structures and Algorithm Analysis, // Third Edition" by Clifford A. Shaffer, Prentice Hall, 2007. // Source code Copyright (C) 2006 by Clifford A. Shaffer. // Test program for checking syntax of a hash table-based dictionary #include using namespace std; #include "book.h" // Include comparator functions #include "compare.h" #include "hashdict.ht" int Intkey(Int& e) { return e.key(); } char* charkey(char*& e) { return e; } int main(int argc, char** argv) { hashdict dict(100, new Int(-1)); Int* val; dict.insert(new Int(10)); if (dict.find(10, val)) cout << "Found value " << val << " to match key value 10\n"; else cout << "Nothing found to match key value 10\n"; hashdict Strdict(100, ""); char* str; Strdict.insert("hello"); if (Strdict.find("hello", str)) cout << "Found value " << str << " to match key value hello\n"; else cout << "Nothing found to match key value hello\n"; }