automated commit by check50 [check50=True]

This commit is contained in:
kukemuna 2024-02-27 20:44:52 +02:00
parent 83872efa5b
commit 1aa9ac6167
1 changed files with 7 additions and 3 deletions

View File

@ -188,16 +188,20 @@ int find_min(void)
// Return true if the election is tied between all candidates, false otherwise // Return true if the election is tied between all candidates, false otherwise
bool is_tie(int min) bool is_tie(int min)
{ {
int match = 0; bool tie = false;
for (int i = 0; i < candidate_count; i++) for (int i = 0; i < candidate_count; i++)
{ {
if (candidates[i].votes == min && !candidates[i].eliminated) if (candidates[i].votes == min && !candidates[i].eliminated)
{ {
match++; tie = true;;
}
else if (candidates[i].votes != min && !candidates[i].eliminated)
{
tie = false;
} }
} }
if (match > 1) if (tie == true)
{ {
return true; return true;
} }