数据结构_串_串的模式匹配_KMP算法_C++实现

"head.h"


#include #include using namespace std; class STRING { public: void GetString(); void GetSubString(); void KMP(); void Print(); private: void GetNext(); string str; string sub; int next[1000]; int strlen; int sublen; }; void STRING::GetString() { cout<<"Please Input The MainString :"<>str; strlen=str.length(); } void STRING::GetSubString() { cout<<"Please Input The SubString :"<>sub; sublen=sub.length(); } void STRING::KMP() { cout<<"KMP Method Called !"<



#include #include"head.h" using namespace std; int main() { STRING str; char choice; while(1) { cout<<"Your Choice Please ?"<>choice; switch(choice) { case '1': str.GetString(); break; case '2': str.GetSubString(); break; case '3': str.KMP(); break; case '4': str.Print(); break; case '5': return 0; default: cout<<"No Such Choice !"<

你可能感兴趣的:(数据结构_串_串的模式匹配_KMP算法_C++实现)