Как я могу проверить, принадлежит ли объект игрока определенной стороне
Specify a void type function named part_of_party (). This function is a friend function in the Party class. It accepts a Party type and a Player type. The purpose of this function is to check if a Player object belongs to a particular Party. The control will only be performed for the player's variable name. If the player is already in the group then the function: 'nameAlreadypartoftheParty' will be printed. If it does not then it will display: 'nameAddedaspartoftheParty: party_name' Where name is the name of the player (variable name) and party_name the name of the Party (variable party_name) into which the player is entered. Along with the name of the player must be entered his level (variable level)
но это ничего не показывает после комплайла :/
Что я уже пробовал:
void part_of_party(Party &party1, Player &player){ bool found = false; for(int i=0; (found == false && i< player.getName().size()); ++i){ if((party1.players[i]).compare(player.getName())==0){ found = true; }; } if (found == true){ cout << player.getName() <<" Already part of the Party"; } else{ cout << player.getName() << " Added as part of the Party " << party1.party_name; } };