Chat bot brain ideas

This is a discussion on Chat bot brain ideas within the C++ Programming forums, part of the General Programming Boards category; Hello,
i start learning C++ and i wanna create my first C++ chat bot, a very simple one so i ...

nice example and a working one, thanks. But i wasn't thinking of that, i was of that but from something different! I was thing that the code if say hello say hi will be in another file for example in brain.txt or brain.bot and i will create the brain like this

//The {} is for the bot and () for human
{Hello}
...then if...
(hi) post {how are you?}
if hi (HI, how are you?)
bot will answer {fine}

There is a good bit of stuff you will need to change but this should give you a good idea. If you are still completely lost then maybe you should take it slower and try something simpler, learn the language better. I am not saying this to depress you or anything, but I am saying it because if you try to jumo in the deep end before you can swim.. you'll drown.

NOTE:
I am sorry if this is still not what you are looking for. Maybe im just lost myself

soory but i don't know what is this?
I know run the program and i see Talk to me.(cool!!!)
but i write many lines without answering only and when i write quit it closes?
Then could you please explain me what do you mean with that
thanks

One way is not to search the file per se. You can read the file one input at a time and compare it to some desired value before going to next item in file, or you can read entire file into a container and search container---tends to be faster than the first method, or you can construct the file so that it is completely predictable with regard structure and use fseek(), etc to appropriately position file pointer to read out just a given piece of data (presumes you know where to look, too!).

I've been playing around with my own sort of "chatbot" that responds based on "emotion numbers" and a "personality" code. It is very difficult and I may not manage it, but it has taught me about breaking up sentences.

1)create a string that the user inputs to.
2)create a char array that takes each letter in the string and puts it into another slot on the array.
2.5)create an string array, where each word can be put into another slot
3)make an if statement in a "for" loop for int "i", where (the string array)[0] == char array[i], and have the "if" statement so if the array ==" " (space), int temp = 0 (the string array)[temp++];
4) make a "for" loop that runs through the sentence and have it check each word with the words in a big switch statement, and make the results, so that if the word is there, it returns the desired response into another string array. Then use a "for" loop to have it print out all the responses.

If you want something a little more difficult, you may try having each word be a structure, and inside the structure is the word and a "grammar" number. Instead of matching with a switch statement, a pointer array (I love arrays) can point to the different words in the "memory", and determine a response based on their grammar numbers, which would pass through a grammar function.

I've been working on this for ages, and it is very difficult, but for a realistic chatbot, try this or save effort and just google :Chatbots

PS:I really hope that string arrays exist, or everything will be a wasted effort.