nk(RL);?}returnOK;}voidOutputSWLinkList(SWLinkListS)//输出待搜索的单词链表的在文本中出现的次数和行号{SWLinkp;RMLinkpr;cout<<"搜索结果:"<<endl;p=S.head->next;while(p)?{printf("%-6s:",p->data.data);?cout<<"出现的次数"<<p->cout<<";";?if(p->cout) { pr=p->RMhead; while(pr){cout<<pr->elem<<","; pr=pr->next;?} cout<<"\b行"<<endl; }?p=p->next;?}}statusOpenFile(PFILE&fp,Stringch)//打开文件{if(!(fp=fopen(ch,"r")))?{cout<<"文件打开失败"<<endl;?cout<<"Pressanykeytoexit"<<endl;getch();returnFALSE;?}returnOK;}voidmain(){PFILEfp;Stringch;charc='Y';SWLinkListS;system("cls");do?{cout<<"请输入要搜索的文本(输入格式为:文本的存放路径\\文本名.扩展名)"<<endl;?cin>>ch;?}while(!OpenFile(fp,ch));do?{CreateSWLinkList(S);?SeekSWLinkList(S,fp);?OutputSWLinkList(S);?cout<<"是否继续进行搜索(Y/N)"<<endl;?cin>>c;rewind(fp);?}while(c=='Y'||c=='y');fclose(fp);cout<<"Pressanykeytoexit"<<endl;getch();}