-
Notifications
You must be signed in to change notification settings - Fork 0
/
function.h
41 lines (36 loc) · 852 Bytes
/
function.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef FUNCTION_H
#define FUNCTION_H
#include <vector>
#include <list>
#include <iostream>
#include <string>
using namespace std;
#define SIZE 41
class Hash_table
{
public:
list<string> table[SIZE];
virtual void Add(const string &str) = 0;
virtual void Delete(const string &str) = 0;
virtual bool Exist(const string &str) = 0;
friend std::ostream& operator <<(std::ostream &os , const Hash_table & ht)
{
for(int i = 0 ; i < SIZE ; i++){
cout<<i<<": ";
for(string str : ht.table[i] ){
cout<<str<<"->";
}
cout<<"[END]";
cout<<endl;
}
return os;
}
};
class Implement : public Hash_table
{
public:
void Add(const string &str) ;
void Delete(const string &str) ;
bool Exist(const string &str) ;
};
#endif