After I saw that RoD was working on RoDBot, on the irc, I looked back at my old chatbot code. Mine was crap. So I'm starting from scratch. Does anyone know of a function that searches a sentence for a specific word?
After I saw that RoD was working on RoDBot, on the irc, I looked back at my old chatbot code. Mine was crap. So I'm starting from scratch. Does anyone know of a function that searches a sentence for a specific word?
Look up std::string::find()
What container does the words reside in? For character arrays, one solution is strstr(). For bytes, one solution is memchr().
Kuphryn
Theres two good ways imo to go about this:
1) txt files
2) enums
I would use the function eibro suggested if your not using txt files. While buggy as it is as far as error checking goes, my code is 100% open source. Feel free to ask any questions u may have, and i will try my best to help.
Heres the latest cpp, not many changes, just a few fixes. convo() is getting totally rebuilt tonight.
Hash table.
Sorry not sure if this c standard. use it so much.
try this if its in std c++
string word, tbuff = " This is my string to find the word string";
int pos;
pos = tbuff.Pos( "string" );
word = tbuff.substr( pos, tbuff.Length() );
or tbuff.Delete( pos, tbuff.Length() );