Docsity

Transition Graphs - Algorithm, Exercises of Algorithms and Programming

Partial preview of the text

Download Transition Graphs - Algorithm and more Exercises Algorithms and Programming in PDF only on Docsity!

#include #include #include #include using namespace std; class Transition{ public: string str; int cnt; string * list; // a function to tokenize the string and store it in the list void strTokenize() { comma ()5 char *cstr = new char[str.length() + 1]; strcpy(cstr, str.c_str()}); char *p = strtok(cstr, ",");// in strtok() first parameter has t@ be a character array int i= @; list = new string[cnt]; // tokenize the string and create a list of states for that symbol while (p != 6) { list[i] = p; itt; p = strtok(NULL, ","); } void showList(){ for (int i=-8; i < cnt; i++) coute<< List[#] << = } private: f/ function to count the comma (',') in the entered set of states void comma() { cnt = 1;