I tried to change it to this but it's still working working
1 2 3 4 5 6 7 8 9 10
//validate input with loop
while (pkgCode != pkgcodeArray[searchIndex])
{
searchIndex++;
if (searchIndex > 5)
{
cout << "ERROR: Package Code does not exist. Please, check and re-enter." <<endl;
break;
}//end if
}//end loop
searchIndex > 5 that means its check if searchIndex is more or same as 6
and i think increment should place on bottom loop, because searchIndex will increase before checking