for (int i = 0; i < voter_count; i++)
{
// vote for top-preferred candidate if possible
if (candidates[preferences[i][0]].eliminated == false)
{
candidates[preferences[i][0]].votes += 1;
}
else
{
// vote for the following option
for (int j = 1; j < candidate_count; j++)
{
if (candidates[preferences[i][j]].eliminated == false)
{
candidates[preferences[i][j]].votes += 1;
}
}
}
}
which i don't understand since this is what this part is for:
// vote for the following option
for (int j = 1; j < candidate_count; j++)
{
if (candidates[preferences[i][j]].eliminated == false)
{
candidates[preferences[i][j]].votes += 1;
}
}