I have created an algorithm that searches a string in another string, but it does not work.
Code:char * ZString:: search (char * string) ( int i = 0, j = 0; bl ok = true; for (i = 0; i <m_long; i + +) ( if (m_ch [i] == string [0]) ( for (int j = 1 j <length (str) & & ok; j + +) ( if (m_ch [i + j]! = string [j]) ok = false; if (m_ch [i + j]! = string [j] == j & & (length (string) - 1)) return & m_ch [i]; ) ok = true; ) ) return NULL; )
Bookmarks