I'm working on a project for class and i cant get one function to work correctly. Basically I'm trying to validate the user input as an interger between 1 and 3 using an if statement. However in the else section I want to either call the function from the beginning or just reinput the information into the variable, but all i get it the program exiting... I'm sure I've over looked something small but I need another set of eyes.
int storyLine::initialPath(void)//user chooses path to start for game
{
{
system("cls");
cout<<"What path will you take?\n""Wormhole 1, 2, or 3?\n""Please make your choice"<<endl;
}
{
cin>>pathChoice; //input 1 2 or 3. 1 easy start. 2 harder start. 3 is death
}
{
if ((pathChoice > 0) && (pathChoice < 4))
{
return pathChoice; // returns a value to be used by sceneChoice function
// *see eventChoices.cpp*
}
else
{
cout << "Invalid choice. Your options are 1, 2, or 3."<<endl;
cin >> pathChoice;
}
}
}