I have a simple while loop i'm trying to implement but for the life of me can't figure out what I'm missing. I have currentuser initialized at the top to -1
while(currentuser = -1){
cout << "Enter user ID: ";
cin >> id;
currentuser = search(a, length, id);
}
My search function is this:
int search (User a[ ], int length, string userID){
User u;
string tempid;
int templegnth; //I ignore length for now as I will use it later
for(int i=0; i<50; i++){
tempid = a[i].getID();
templegnth = tempid.length();
if((tempid == userID)){
return i;
}
}
return -1;
}
I know its something very simple but the answer escapes me right now.
while(currentuser == -1)Note==. If that's not it, you might consider actually describing what the problem is and asking a question.