+ 2
How can we find a word from text using loop
cpp
2 Answers
+ 9
If the text is all one string, then go through each character of the string. Have an if statement that checks for matching characters in the string. If one is found, advance one character in both the search word and the string of text.
Interesting question; this is also used for searching pi for patterns and digits. If you want more info, respond back or search for "searching for digits of pi" or something like that. I bet hat there is a ton of information out there about this.
0
Look up Knuth-Morris-Pratt and Boyer-Moore Algorithms on Wikipedia.