0

Im strugling with print_winner function in Tideman election program. In my opinion function workes fine. It prints the candidate which has all false values in column under his name (number) in locked array. So that candidate didn't had an arrow (edge) pointing at him and he is the source of the graph. Check50 gives me :( on this function, and i don't have a clue what's wrong. I had deleted all printf() functions that I used to check some values.

My code for vote_function:

// Print the winner of the election
void print_winner(void)
{
bool flag;
for (int i = 0; i < candidate_count; i++)
    {
        flag = false;
        for (int j = 0; j < candidate_count; j++)
        {
            if (locked[j][i] == true)
            {
            flag = true;
            break;
            }
        }

            if (flag == true)
            {
                continue;
            }

            else if (flag == false)
            {
                printf("%s \n", candidates[i]);
                continue;
            }

     }
     return;
}
  • I have found the "bug" and all is ok. – RafalH123 Oct 13 at 21:51

You must log in to answer this question.

Browse other questions tagged .