I just had a crazy idea to make a simple smarterchild type talking robot. All it does is remember your name and say hello...stuff like that...and then you can ask Do you know....and he will search his Database for any knowledge of that topic and if he doesn't know then he asks you to tell him so he can recall the knowledge. I think that will require the use of file i/o....any helpful hints on coding?

03-18-2006

SlyMaelstrom

Quote:

Originally Posted by bumfluff

....any helpful hints on coding?

Start doing it... ?

What kind of hints do you want? You know what you want to make and you have an idea on how you want to make it. So get where you can and when you run into an issue, tell us about it. What you told us is so general, I wouldn't know where to begin with hints. Be efficient... indent... be modular... I don't know what else to say.

if ( help == "no" ) {
system("CLS");
cout<<"I am the greatest revelation in computing technology since"<<endl;
cout<<"the the invention of Microsoft DOS. You can ask me different"<<endl;
cout<<"questions. However, as I am in the early stages of deveolment"<<endl;
cout<<"I can only understand do you know and who are you questions."<<endl;
cout<<endl;
cout<<"For an answer to a do you know question type in 'do you know?'"<<endl;
cout<<"I will reply and then you should type in the subject that you"<<endl;
cout<<"would like for me to tell you about. If I do not know then"<<endl;
cout<<"you can tell me what it is so I will know in the future."<<endl;
cout<<endl;
cout<<"The other question you can ask me is who I am, simply type"<<endl;
cout<<"'who are you' and I will tell you."<<endl;
cout<<endl;
cout<<"And remember, always type in lower case!"<<endl;
cout<<endl;
cout<<"Press enter when you are done.";
cin.get();
endl;
system("CLS");
cout<<"Now that you're ready to talk to me, what do you want to ask?"<<endl;
}
else {
cout<<"So, what do you want to talk about?"<<endl;
}
do {
cout<<endl;
cout<<name<<"'s says: ";
getline (cin, question);
cout<<endl;

It is meant to save the information about the subject to a file and then if you ask about that subject again...it will give the definition..however it only reads the first word og teh definition e.g full definition = a loose fitting t-shirt

all it will say is

a

03-18-2006

Ideswa

Code:

ifstream load("file.dat");

load >> string1;
load >> string2;
load >> string3; // this will read 3 words with spaces. But you'll have to know the number of words!