Hello,
I am writing a small program that has many different options in it and
when you start it, it will show you a menu. But the problem is that
you can only push in a few letters to use the menu and if you put a
wrong one it will say please select a better option. But if you type
in more than one wrong character it will run the error catching lines
again. How do I get this to run once even if there are 6 wrong
characters inputted? The error catching code I have now look like:
int main(int nNumberofArgs, char* pszArgs[])
{
Error =3D 0;
MENU:
cout << "Student Pack \t\t\t\t\t\t\t\t v1.0" << endl << endl;
cout << "Please Make A Selection " << endl;
cout << "------------------------" << endl;
cout << "(M)oney Counter" << endl << endl;
cout << "(T)emperature Converter" << endl << endl;
cout << "(C)alculator" << endl << endl;
cout << "C(r)edits" << endl << endl;
cout << "(B)ug Reporting" << endl << endl;
cout << "(E)xit" << endl << endl;
cin >> menuSelection;
if ((menuSelection =3D=3D 'm') || (menuSelection =3D=3D 't') || (menuSelect=
ion
=3D=3D 'c') || (menuSelection =3D=3D 'r') || (menuSelection =3D=3D 'b') ||
(menuSelection =3D=3D 'e'))
{
menuSelection =3D (menuSelection - 32);
}
else
{
Error =3D Error + 1;
system("CLS");
while (Error =3D=3D 1)
{
Error =3D Error - 1;
cout << "Please make a proper slection. " << endl;
getch();
system("CLS");
goto MENU;
} =20
=20
}
Notice: This is not even close to all the coding but this is where the
problem is taking place.
Please help me if you can.
Thank you.
--=20
-Ryan
|