// Add this after calculating preferences printf("\n--- ELECTION RESULTS VISUALIZATION ---\n");
print_winner();
if (!has_ties) printf("✓ No ties in sorted pairs (all margins unique)\n"); } cs50 tideman
=== TIE-BREAKING VISUALIZATION === Total pairs created: 6 --- BEFORE SORTING --- Pair 1: Alice vs Bob Alice got 5 votes Bob got 3 votes Margin: Alice wins by 2 votes } When you run this feature
int margin = preferences[pairs[pair_index].winner][pairs[pair_index].loser] - preferences[pairs[pair_index].loser][pairs[pair_index].winner]; // NEW FEATURE
return 0; } When you run this feature, you'll see:
// Run the tie-breaking visualization add_pairs(); visualize_tie_breaking(); // NEW FEATURE