I'm pretty new to c++ (Like yesterday) and I downloaded Code::Blocks and started to get to work on learning it. I ran into a problem though for some reason this code below will say it found the person even though I did not even put the correct fullname to search for.
string fullName = firstName + lastName;
bool doesEmployeeExist(string fullName);
database getEmployee(string fullName);
data.firstName = "bob";
data.lastName = "builder";
data.age = 55;
data.skill = "Programming";
employees = data;
cout << "Please enter the employee your looking for:" << endl;
cout << "Could not find that employee!" << endl;
cout << "We found the person you were looking for!" << endl;
bool doesEmployeeExist(string fullName)
for (int a=0;a<3;a++)
database testData = employees[a];
if (testData.fullName == fullName)
database getEmployee(string fullName)
for (int a=0; a<3; a++)
database maybeEmployee = employees[a];
if (maybeEmployee.fullName == fullName)
returningProfile = maybeEmployee;
Two other questions I had number one being is there a better way to check if the person your looking for is in an ?
Secondly on the input of the console were it assigns the lookingForFullName if I was to put a space in it only takes in the first arg. Any way to make that take in all args following the first?
Thank you for reading and I hope you can help!
I ran into a problem though for some reason this code below will say it found the person even though I did not even put the correct fullname to search for.
If you had said "It won't find the person, no matter what fullname I input," I would've believed that. As it is, the behavior you describe can't happen as the only value any database in the employees array has for the member fullname is an empty string.