Make your own free website on Tripod.com

Back

// Matt Kaliszewksi
// COMP411 - Lab 06
// October 16, 2002
// HashTable.h

#ifndef HASHTABLE_H
#define HASHTABLE_H

#include <iostream>
#include <string>
#include "User.h"
#include "Link.h"
using namespace std;

//////////////////////////////////// HASHTABLE CLASS ////////////////////////////////////

class HashTable {
public:
       HashTable();                                          // Default constructor
       User* getUser(string username);              // Method to get a user
       bool insertUser(User *nuser);              // Method to insert a user into the hash table
       bool deleteUser(string username);       // Method to delete a user from the hash table
       void print();                                          // Method to print the contents of the hash table
       void printUserInfo(string username);// Prints all information about a user

private:
       Link *table[10];                                   // the hash table
       int buckets;                                          // number of buckets in the hash table
       int hash(string username);                     // Method to calculate the hash based on the username
};

#endif

Back