Hi guys, I am looking for a way to check for error. I have an array of names. The user will enter a name and it will check the list for that name. If that make is not correct, it will go back and ask the user to try again until he types "Quit" or gets the name correctly. This is what I have so far. I know that there is no loop besides the for loop that just makes sure the name is on the list. I have tried a while loop and that doesn't seem to work the way I want it to. Please let me know if you guys have a solution.
getline (cin, Command);
Name[K].Firstname = Command;
for ( T = 0; T<30 ; T++) {
if( Name[T] == Name[K].Firstname) //K is a static variable because this is a program that will run forever and will save each and every name within the Name[K]Firstname that the user enters.
{
cout << "Correct";
break;
}
else
{
cout << "Invalid Species try again :" << endl;
}
}