Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C++: Bot


ghost's Avatar
0 0

Hello, I'm not trying to programming a advance bot. I want some ideas how I should do. I want a bot who can answer on simple question. example. ask: What do wanna know? [putting in for example PHP] answer: Php is a server-side programming language.

I don't wanna make an if and else function for about 100-200 things. I want make it easier! Maybe an external file should be nice but how can I search and get information from an external file. I know how to open and read but not search in the file. Can I get some help/ideas ?

Best regards, Erox


ghost's Avatar
0 0

First thing I think of is making a MySQL-database (or other kind of database), make a table with one field with keyword(s) and one field with the actual answer.

Then:

SELECT answer FROM table_name WHERE keywords LIKE '% <question here> &'

And display the first one. Or you could create another search algorithm, But I think of a kind of search engine-like thing.

<EDIT>The example I gave would at least work for searching for one specific term</EDIT>


Futility's Avatar
:(
80 122

There's a fancy language to code this sort of artificial intelligence. I don't really know much about it, but google/wikipedia AIML and it should help. Best of luck.


ghost's Avatar
0 0

Thanks I'll try to program it :D