I'm in the midst of working on tideman, in the midst of it i decide to check for the add_pairs
function but i realised check50
is throwing me red coloured texts, solely based on add_pairs
. I debugged line by line but I still can't pinpoint where my mistake lies.
It's odd as i passed 2 out of 4 of the add_pairs
check,
add_pairs function:
void add_pairs(void)
{
// TODO
// Preferences integers of stringed candidates
// Candidates string
// pairs - struct -> int winner, loser
// i & j -> based on candidates
for (int i = 0; i < candidate_count; i++) {
for (int j = i + 1; j < candidate_count; j++) {
if (preferences[i][j] > preferences[j][i]) {
pairs[pair_count].winner = i;
pairs[pair_count].loser = j;
pair_count++;
break;
}
else if (preferences[i][j] < preferences[j][i]) {
pairs[pair_count].winner = j;
pairs[pair_count].loser = i;
pair_count++;
break;
}
}
}
printf("[add_pairs]\n");
for (int i = 0; i < pair_count; i++) {
printf("Winner: %i, ", pairs[i].winner);
printf("Loser: %i\n", pairs[i].loser);
}
return;
}
Appreciate all the feedback.