I'm new to programming because I want to make a game myself. I was doing the "hello world!" beginner exercise, it the turned to a project the Ive been building up for. I was trying to make the program/AI to communicate in a way that when it ask something like "how are you?", and if i say "good", i would say "cool". I also added a random generater that works with ctime that pick a number 1 to 3 so that if i say "good", it will either reply with one of the three phrases.
Try reading this for a start. There's a sample program you can run by pressing on the wheel at the top right. It incorporates some if not all of concepts you are chasing.
Remember we are not in the room so can't see the output you get. Posting the errors here would help us be able to help you.
PLEASE, use code tags when you post code. It makes your source easier to read. You can go back and change your original post to include code tags.
http://www.cplusplus.com/articles/jEywvCM9/
Line 13, 17, 21: C++ does not support implied left hand side in conditionals. You must fully specify the conditions.
Example: if (ans == 'Y' || 'y') evaluates as if ((ans == 'Y') || ('y'))
('y') always evaluates to 1 (true), therefore the if statement is always true.
Line 14, 18, 22: What are these lines supposed to be doing? Diceroll00 == 1 looks like a conditional, but it's not enclosed in (). Did you mean to use the assignment operator (=)?
Line 14, 18, 22: What are these lines supposed to be doing? Diceroll00 == 1 looks like a conditional, but it's not enclosed in (). Did you mean to use the assignment operator (=)?
I was trying to use the random number generator to make the AI respond with one of the choices out of the three phrases, I dont want the AI to respond with the same response everytime.
I would recommend highly using the C++ <random> library instead of the C library rand() function. :) rand() has...."documented problems."
You are already using a good C++ random engine, mt1997. I'd say stick with that one. You might run into problems with default_random_engine, depending on what compiler you use. GCC has problems with that engine, even with the latest version (6.10). default_random_engine in GCC gives the same non-random series.