...if you can't figure out where/how to place that code, I really don't think you're ready for a dip in the AI pool...
I got bored and wrote this up real quick:
Code:
#include <iostream>
#include <string>
void capitalize(std::string &input);
int main()
{
std::string input;
std::cout<<"Hello. I am testBot. Please reply with an empty line\n"
<<"to end our conversation\n> ";
while(getline(std::cin,input,'\n'))
{
capitalize(input);
//std::cerr<<"::"<<input<<std::endl;
if(input=="HI" || input=="HELLO" || input=="HEY" || input=="YO")
{
std::cout<<"Hello, how can I help you today?\n> ";
}
else if(input.substr(0,3)=="WHO")
{
if(input.substr(4,4)=="MADE" ||
input.substr(4,5)=="WROTE")
{
std::cout<<"I was written by Major_Small\n> ";
}
}
else if(input=="" || input=="BYE" || input=="GOODBYE" ||
input=="LATER" || input=="NIGHT" || input=="GOODNIGHT")
{
std::cout<<"Good bye for now."<<std::endl;
break;
}
else
{
std::cout<<"Sorry, I could not recogize your accent\n> ";
}
}
return 0;
}
void capitalize(std::string &input)
{
std::string temp=input;
register short int l;
register short int r;
for(l=0,r=input.length()-1;l<=r;l++,r--)
{
temp[l]=toupper(input[l]);
temp[r]=toupper(input[r]);
}
input=temp;
}
that's not a very useful/scalable example, so I wouldn't use it (and besides, if you ask it who wrote the declaration of independence, it just tells you who wrote the bot), but there are some things you can take away from it... like how there are different ways to say hello/goodbye/etc, and how people capitalize differently, and a whole host of different things like what if somebody forgets a space or their english isn't the best? what about the differences from "howdy/hello/hi/hey there/what up/hai2u/etc."
you may want to write a file with questions and responses and use a scoring system or something. for example, have "who/wrote/made/created/you/this/bot" as something to check the input against and have "I was created by me" as the response to that. Now check the input sentence for the words and give that answer a score. the response with the highest score gets output.
These ideas are all my own, and to be honest, I don't know a whole lot about AI programming, so you'd probably be better off asking somebody else, but like I said, just look at the code and take note of some of the pitfalls you'll want to look into getting over...