linear search function problem

nevermind
Last edited on
1. Why are you saving userID to different UserRecord than you do with passwords and PINs? You created struct to hold all three pieces of information inside ONE variable
1
2
3
4
5
6
7
8
9
10
UserRecord fromPrompt;
bool foundMatch = false;
int count = 0;
do
{
    fromPrompt.userID = PromptID();
    fromPrompt.password = PromptPW();
    fromPrompt.PIN = PromptPin();
    foundMatch = FindMatch(fromPrompt, listOFUsers);
} while (count++<3 && foundMatch == false); 

2. Think about what does it mean for UserRecord type to be equal to another UserRecord, before you try to compare the two with equality operator "==".
You could probably start simple with something like this:
1
2
3
4
5
6
7
8
9
if ( file[index].userID == toBeMatched.userID ) 
{ 
    // If there is a user, check his password and pin
    if (file[index].password == toBeMatched.password &&
        file[index].PIN == toBeMatched.PIN )
    {
        matchFound = true;
    }
} 
Last edited on
Topic archived. No new replies allowed.