Hi
Started c++ at uni (doing games programming) 5 weeks ago....its way tougher than i expected !!!
Anyway....been on with this for ages and i cant get it to work....i have 2 names stored in a character array, and the user inputs into the aryInput array and i need it to verify that what has been entered is in the aryLoginName array....my problem is that if John is input, it outputs correctly, if Steve is entered it says invalid name...so it doesnt seem to be looping (?)....let me know if i havent explained it clearly....heads in a spin after working on the thing for hours...thanks!:
Code:void login() { char aryInput[10]; char aryLoginName [2] [10] = { "John", "Steve", }; cout << "Please enter a valid name> "; cin >> aryInput; for(int k = 0; k < 2; k++) // names { int temp = strcmp( aryInput, aryLoginName[k]); if( temp == 0) { cout << "You entered the correct name" << endl; break; }else cout << "Invalid name"; break; } }