Description: #include <iostream>
#include<string>
#include <cstdlib>
#include"fstream"
#include <ctime>
using namespace std
#define TableSize 5
struct DataType
{
string name
string sex
string grade
string addr
int age
}
typedef struct Node
{
DataType data
struct Node*next
}Node ,* IP
typedef IP HashTable[TableSize]
int HashName(string s)
{
unsigned sum=0
for(int i=0 s[i]!= \0 i++)
{
sum=+s[i]
}return sum 5
}
void InitHashTable(HashTable H)
{
for(int i=0 i<TableSize i++)
H[i]=NULL
}
void InsertName(HashTable &H,DataType e)
{
int ha=HashName(e.name)
IP p=new Node
p->data=e
p->next=H[ha]
H[ha]=p
}
void TraverseName(HashTable H)
{
for(int i=0 i<TableSize i++)
{
IP p=H[i]
cout<<i<<":"
while(p)
{
cout<<"名字:"
cout<<p->data.nam
To Search:
File list (Check if you may need any files):
san lie biao
............\main.cpp
............\main.exe
............\main.o
............\out.txt