Originally Posted by
khh
Firstly what you're trying there won't work. If you want to compare two strings you need to use strcmp() or something. strcmp() is a function that returns the number of characters that are different between two strings. In your example, you could have written
if (!strcmp(userinput, "fuck"))
(don't forget to include string.h/cstring
and it would have worked as you expected.
But in order to search a string containing more than one word, you'd probably have to loop through it and isolate the words (looking for characters that are not letters), and then compare each word against the word you want to detect.
edit: ... Or you can use the built inn find function of the string class, it seems :p