Ok, so I'm working on my school project and I have a class that stores the Customers information, in the main file it then asks for the customers ID number and then checks to see if the value is true or false from the criteria entered. However, it is just returning false even though the value is true.
Here is part of the main program (where it checks):
switch (option)
{
case '1': char critera;
system("cls");
cout << "Search for customer: " << endl;
cout << ">> ";
cin >> critera;
if(customers(critera) == true)
cout << "Username Found!";
else
cout << ">> There is no user with this ID\n\n\n\n\n\n";
break;
And this is the function that checks it against the values stored in the class:
char customers(char critera)
{
// run an if statement to check the users
Customer s[255];
s[0].setID(1);
s[1].setID(2);
for(int i=0; (i<255); i++)
{
if(s[i].getID() == critera)
return true;
return false;
}
}
Anyone got any suggestions? I really need this to work :( thanks guys!