I have a class named "Division" that has an array of vectors inside of it.
int search(int lower, int upper, Role role);
The class above has plenty of functions in it, but they shouldn't be relevant.
The "player" player class is also pretty simple,
Role is a simple enum, can be ROLE_SUPPORT, ROLE_DPS, ROLE_TANK, or ROLE_ANY.
This next function is the one I have a problem with. The SR of the players should be within 0-5000, and I wish to be able to search through the vector of players for a player between an upper bound and a lower bound, which is what the following code is supposed to do.
int Division::search(int lower, int upper, Role role)
for (int i = 0; i < m_division.size(); ++i)
if ((m_division[i].m_sr <= upper && m_division[i].m_sr >= upper) && m_division[i].m_role == role)
cout << "None found within that range and with that role\n";
Unfortunately it doesnt. In fact, no matter what i do, it returns -1 and prints the error message i created. I know that there is a solution to what its looking for, so why wont it work?
if i call it like i do in main,
cout << NA.getName(NA.search(2100, 2200, ROLE_ANY));
(NA is a division) it always returns -1 even though I know for a fact that there is a player between 2100 and 2200 who has role_any, and its in position 3. Please help.
i uploaded the full program to github here
any help would be greatly appreciated.
Testing.csv is a bunch of randomly generated numbers and strings, it is correctly formatted for the program. "Scrub Cup work" is where main resides, and all classes are the parse function are in their respective .h and .cpp files