count[p->idx ].times++;//统计数组对应元素加1
found=TRUE;
}//若键树中含有"commit",文本行中为commit则为找到,若为committing则为没找到
}//if
}//else
}//while
return found;
}//Search_DLTree
void setmatch(DLTree root,char *line,FILE *f){
//统计以root为根指针的键树中,各关键字在本文本串line中重复出现的次数,
//并将其累加到统计数组count中去
unsigned i=0;
int k;//若查找成功,返回的k为所查找的关键字长度
while (fgets(line,LINESIZE,f)!=NULL){
cout<
while (i<=strlen(line)){//LINESIZE){
if (!Search_DLTree(root,i,k)) {
if (((line[i]>='a' && line[i]<='z')||(line[i]>='A'&&line[i]<='Z')||(line[i]>='0'&&line[i]<='9')) &&!((line[i+1]>='a'&&line[i+1]<='z')||(line[i+1]>='A'&&line[i+1]<='Z')||(line[i+1]>='0'&&line[i+1]<='9')))
NUM++;//单词总数加1
i++; //若查找不成功,则从下一个字符开始查找
}//if
else {
i+=k; //查找成功,继续在文本串中的第i+k-1个字符开始查找
NUM++;
}//else
}//while
}//while
}//setmatch
void Input(FILE *&f){
char fname[30];
cout<<"please input the file name:";
cin>>fname; //输入文件名
if ((f=fopen(fname,"r"))==NULL){//输入错误文件名, 无法打开
cout<<"Can NOT open the file!"<
}
}//Input
void output(int n){
cout<
if (count[i].times){
cout<
cout<