+ 1
Console game problem | C++
I just started making a console game, and I've come to an if-statement where it doesn't work as I want it to do: This is my code for the if-statements: https://gyazo.com/e3e08caf4400e3c05ed8b64120dd14fe When I say "drive by" to the question: https://gyazo.com/85c330f950f2159d668aaa8b17e445b9 https://gyazo.com/3108762c8ed37321098862e0c74c418b As you can see, it acts like a said "talk" but I didn't, and I don't know why it doesn't skip the if statement, and goes to the else if instead. Please help, I can't continue my game, until this is fixed. It tears me apart.
4 odpowiedzi
+ 2
if(Q[5] == "Talk" || "talk") isn't going to work, "talk" will evaluate to true. Use if(Q[5] == "Talk" || Q[5] == "talk"), same thing with your other ifs.
+ 1
Are you reading to Q[5]? where are the statements that accepted the input? Also, you may want to clear Q[5] before reading to it, to rule out any prior junk in it.
+ 1
@dennis you'are right I didn't see that one
0
Thank you, very much @Dennis.