Code:
int company=25;
int infiniteLoopCout=0;
...
while (company>24&&infiniteLoopCount<10)
{
std::cout<<"Which Company Is The Part For?"<<endl;
std::cout<<" AMT 0"<<" || Mercury 13"<<endl;
std::cout<<" Barber 1"<<" || Misc. 14"<<endl;
std::cout<<" BeloitCP 2"<<" || Modern 15"<<endl;
std::cout<<" Borg 3"<<" || Nissan 16"<<endl;
std::cout<<" Bosch 4"<<" || Packard 17"<<endl;
std::cout<<" Camcar 5"<<" || Phil 18"<<endl;
std::cout<<" Colt 6"<<" || Simmons 19"<<endl;
std::cout<<" Durst 7"<<" || SSI 20"<<endl;
std::cout<<" Enkel 8"<<" || Tradewind 21"<<endl;
std::cout<<" Goex 9"<<" || Warman 22"<<endl;
std::cout<<" Isthmus 10"<<" || Warner 23"<<endl;
std::cout<<" Kulasik 11"<<" || Witco 24"<<endl;
std::cout<<" Lear 12"<<" ||"<<endl;
std::cout<<"\nEnter Choice Here:";
std::cin>>company,cin.get();
std::cin.clear();
infiniteLoopCount++;
}
if (infiniteLoopCount>=10)
{
/*normally you would use a try/catch block for this...but what the hey, lyall could use a little entertainment...
plus i'd like to see what his reaction would be, considering he doesnt use a computer all that much...*/
system("cls");
ErrorHandler("Oh No!!!\nYou've Been Caught In The Infinite Loop Of Death!!!\n\nNext Time Enter The Number Of The Company, Have A Nice Day\n");
}
}
that's the original code, i'm going to try that last suggestion though