##实验题目
Complete a text searching engine using hash table.
完成一个文本搜索引擎,使用哈希表
----------
##实验目的
练习哈希算法的使用,对数据结构有一定的概念Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of the same day. May be back in the past, to oneself the paranoid weird belief disillusionment. These days, my mind has been very messy, in my mind constantly. Always feel oneself should go to do something, or write something. Twenty years of life trajectory deeply shallow, suddenly feel something, do it.
The end of our life, and can meet many things really do?
During my childhood, think lucky money and new clothes are necessary for New Year. But as the advance of the age, will be more and more found that those things are optional. Junior high school, thought to have a crush on just means that the real growth. But over the past three years later, his writing of alumni in peace, suddenly found that isn't really grow up, it seems is not so important. Then in high school, think don't want to give vent to out your inner voice can be in the high school children of the feelings in a period. But was eventually infarction when graduation party in the throat, later again stood on the pitch he has sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already can't remember his appearance.
Originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.
A person's time, your ideas are always special to clear. Want, want, line is clear, as if nothing could shake his. Also once seemed to be determined to do something, but more often is he backed out at last. Dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. Those who do, just green years oneself give oneself an arm injection, or is a self-righteous spiritual.
At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid shirt. Those were broken into various shapes of stationery. From the corner at the beginning of deep friendship. Have declared the end of the encounter that haven't start planning... Those years, those days of do, finally, like youth, will end in our life.
----------
##程序设计
####程序流程图
<img src="https://img-blog.csdn.net/20141130155857906?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxNDQ3MTU1Nw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />
####程序代码
#####程序变量
const int HASH_SIZE=100;
vector<string> container;
struct hash_node{
int number;
string key;
hash_node* next;
hash_node(string a="",int b=0,hash_node* c=NULL);
};
hash_node* hash_chain=NULL;
string word;
#####初始化
方法是从文件流单个读取字符,遇到句号,问号,感叹号和省略号都视为断句标志,利用了char和string之间的转换,出现bug的情况是句子字符长度超过1024,这个概率太小。程序兼顾了去除前导空格的功能。
bool ReadFile(string source){//读取文件并存储
ifstream fin;
fin.open(source.c_str());
if(!fin){//打开文件失败
cout<<"Unable to open "<<source<<"."<<endl;
return false;
}
//cout<<"open success"<<endl;
container.clear();
char buffer[1024]={0};
int k=0;
string temp;
while(!fin.eof()){
buffer[k++]=fin.get();
//断句符有三个
if(buffer[k-1]=='.'||buffer[k-1]=='?'||buffer[k-1]=='!'){
temp=buffer;
con