Hi, I am a begginner at c++ programming and have been trying to create a simple texted based game, nothing too fancy. I have made a few other programs such as "guess my number" and an average finder. What I have been trying to do is create simple user-commands in my game, or at least incorporate the ability for the user to use actual words, like "yes" and "no" instead of just y and n. If possible, I'd like to be able to program a way for a player to type "instructions", or, "help", and have text pop up. I have been trying to use strings to do these kinds of things and haven't had any luck. If someone could help me out, I'd really appreciate it. If someone wants, I can post one of my failed code trials.
If possible, I'd like to be able to program a way for a player to type "instructions", or, "help", and have text pop up. I have been trying to use strings to do these kinds of things and haven't had any luck.
char example1 = 'x'; //that is all it can store, you can't store anymore info in example1
char example2 = 'Excelsior!' //example 2 stores ONLY !, the rest of it was too long to fit into the single character
Where do the rest of the characters go? Not into memory, that's where. You would need to declare it as an array like you did on line 10, or, better yet, use the string class, that was designed to hold strings.