Hello c++,
This is my first post, so I figure I would start by saying Hello. I'm a student at Auburn University in a C++ class, and I've come here to get some advice as I am new to the C language. I'm almost done with my project, which is a text based video game. I currently have 4 classes to run this program. Player, Hall, Menu and Engine. The class Menu is a class to display the options available in the menu based game, and return the value entered by the user. Currently, if you enter a value that is not contained in the menu, my program goes haywire in a infinite loop that I can't figure out. I need to filter the input of the user to make sure that they enter a desired value so I wrote a function called bool isValidInput(int input). I can't figure out why my function isn't looping until the input I enter is valid. I think it has to do something with the fact that it gets the input from cin, and if that input it wrong it can't reset menuChoice using cin again because it already set menuChoice??? Help please!!! Here is a snippit of my code so you can get an idea of whats going on: