#include "hashtable.h" #include /* THIS IS NOT A REAL HASH TABLE IT IS JUST A CHEAP STAND-IN */ struct Link { string name; int value; Link * next; Link(string n, int v, Link * x) { name = n; value = v; next = x; } }; hashtable::hashtable() { first = NULL; } int * hashtable::find(string s) { Link * p = first; while (p != NULL) { if (p->name == s) return & p->value; p = p->next; } return NULL; } void hashtable::set(string s, int v) { Link * p = first; while (p != NULL) { if (p->name == s) { p->value = v; return; } p = p->next; } first = new Link(s, v, first); }