I have to do this username, password, and PIN program, and i need help for the last part. I need to set up an array for 50 users and 3 attempts for 1 user. Here is what i have so far
//Checks to see if user matches an object in authorized_users
bool loginUser(UserRecordArray authorized_users, UserRecord user)
{
//TODO
}
//passes in a UserRecordArray object and populates it from users.txt
//returns true on success, false on failure (use this to check the file read operations)
bool readUserFile(UserRecordArray users)
//loop through the users array and print each one
void printUsers(UserRecordArray users)
the comments are what i have to do, but I'm not sure how to do them
That's not going to do what you want. That won't tell you if the user entered a non-numeric. pin is type int and the statement will never be false.
bool readUserFile(UserRecordArray users)
You're passing users by value. This means users is a local copy. readUserFile won't update the caller's array. You need to pass users by reference.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
That's not going to do what you want. That won't tell you if the user entered a non-numeric. typeid of pin is int and the statement will never be false.
Did you try to compile what you posted?
Line 24: infile is not defined.
Lines 75-85: Where do these lines belong? They're not part of a function.
Lines 86-93: Is this supposed to be a function? If so, it is incomplete. user is not defined. Missing opening and closing braces for the function.
how do i pass arguments as references with the text file?