/////// File: tstHsTbl.C /////// #include #include "HashTable.h" #include "Employee.h" #define HT_E HashTable char* getkey(Employee& e) // required getkey function { return( e.id() ); } main() { Employee a("Big Mac", 39, "023441288"); Employee b("John Doe", 32, "083467890"); Employee c("Joe Smit", 24, "333451282"); Employee d("Joe Smi", 27, "333451228"); Employee e("Joe Sm", 28, "333452128"); Employee f("Joe S", 29, "333415228"); Employee z; HT_E ht(1); // very small hash table for testing ht.put( b ); ht.put( a ); ht.put( c ); ht.put( d ); ht.put( e ); ht.put( f ); if ( ht.get("333415228", z) != HT_E::noe ) cout << z << endl; else cout << "333415228 not found \n" ; ht.rid(getkey(a)); if ( ! ht.is_on(getkey(a)) ) cout << "023441288 not found \n" ; if ( ht.get("083467890", z) != HT_E::noe ) { cout << z << endl; } else cout << "083467890 not found \n" ; cout << ht.length() << "=len\n"; ht.rid(getkey(d)); ht.rid(getkey(e)); cout << ht.length() << "=len\n"; }