int max = 0; bool isP = false; for (int i = 1; i < votes.size(); i++) { if (numberVotes[max] > numberVotes[i]) max = i; } for (int i = 0; i < votes.size(); i++) { if (numberVotes[max] == numberVotes[i] && votes[max] != votes[i]) isP = true; } if (isP) { vector plurals; plurals.push_back(votes[max]); for (int i = 0; i < votes.size(); i++) { if (numberVotes[max] == numberVotes[i] && votes[max] != votes[i]) { bool found = false; for (int j = 0; j < plurals.size(); j++) { if (votes[i] == plurals[j]) found = true; } if (found) plurals.push_back(votes[i]); } } cout << "Tie between: "; for (int i = 0; i < plurals.size(); i++) cout << plurals[i] << ". "; } else cout << "Winner is: " << votes[max];