start: //<<<<<<<<<<<<<<<START>>>>>>>>>>>>>>>>>>
cout << "Welcome to Minesweeper:" <<endl<<endl;
cout << "1. New Game." <<endl;
cout << "2. Replay previous Game." <<endl;
cout << "3. Help." <<endl;
cout << "4. QUIT Program" <<endl<<endl;
cout << "Please select an option: ";
cin >> select;
{
if(!cin) //Checking if input is an integer
{
system("cls");
cout << "INPUT FAIL!"<<endl<<endl;
cout << "Please only use numbers when making selection.";
system("pause > nul");
goto start;
}
elseif ((select < 1) || (select > 4)) //Checking if input is within selection range (1 - 4)
{
system("cls");
cout << "Please select 1 - 4 ONLY";
system("pause > nul");
select=0;
goto start;
When debugging the program, the program loops around the first IF statement over and over. Do I need to clear the int 'select' before going back to start?
Now, I need to use this function multiple times in my code. How would I include this in a header file I already have that contains other useful functions that I have been calling to in my code?