About Cin & Memory | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About Cin & Memory

I'm starting a game project, it is text based a sort of "choose your own adventure" how can I ask multiple times "cin" and to allocate in the memory the answer For example if the games ask yes or no, if I input yes I want how can I continue the story? I thought to do this with numbers, 1=yes 2=no and if I need to ask the player to give an answer later it would be 3=yes 4=no but I need I'm still needing a rule for the player to no input 3 and get spoiled and break the game. What do you think? Any advice?

14th Apr 2017, 4:51 PM
Juan Bautista Iacobucci
Juan Bautista Iacobucci - avatar
1 Answer
+ 7
Accept it with char datatype y for yes n for no check it in an if statement~continue here.
14th Apr 2017, 4:53 PM
Pixie
Pixie - avatar