# My runoff problem doesn't pass check50

when I run check50 this is the message I get and I don't know what to fix

``````:( tabulate counts votes when all candidates remain in election
tabulate function did not produce correct vote totals

:( tabulate counts votes when one candidate is eliminated
tabulate function did not produce correct vote totals

:( tabulate counts votes when multiple candidates are eliminated
tabulate function did not produce correct vote totals
``````

this is the code

``````bool vote(int voter, int rank, string name)
{
for (int a = 0; a < candidate_count; a ++)
{
if (strcmp(candidates[a].name, name) == 0)
{
preferences[voter][rank] = a;//a is the location of the candidate
return true;
}
}
return false;
}

// Tabulate votes for non-eliminated candidates
void tabulate(void)
{

for (int i = 0; i < voter_count; i ++)
{
for (int j = 0; j < candidate_count; j ++)
{
if (candidates[preferences[i][j]].eliminated == false)
{
}
/*else
{
}*/
}
}
return;
}

// Print the winner of the election, if there is one
bool print_winner(void)
{
for (int i = 0; i < candidate_count; i ++)
{
{
printf("%s\n", candidates[i].name);
return true;
}
}
return false;
}

// Return the minimum number of votes any remaining candidate has
int find_min(void)
{
int min = voter_count;
for (int i = 0; i < candidate_count; i ++)
{
if ((candidates[i].eliminated == false) && (min > candidates[i].votes))
{
}
}
return 0;
}

// Return true if the election is tied between all candidates, false otherwise
bool is_tie(int min)
{
for (int i = 0; i < candidate_count; i ++)
{
if (candidates[i].eliminated == false && candidates[i].votes != min)
{
return false;
}
}
return true;
}

// Eliminate the candidate (or candidates) in last place
void eliminate(int min)
{
for (int k = 0; k < candidate_count; k ++)
{
{
candidates[k].eliminated = true;
}
}
return;
}
``````

If I run debug50 on your code as follows: `./runoff alice charlie bob` and `number of voters: 3` and try to print out each individual's count and name in the end, it shows me this:
`3, alice 3, bob 3, charlie`
It seems like for each voter every non-eliminated candidate gets a vote, no matter who their actual preference is. Meaning, it starts at the first voter and loops through `j < candidate_count` and gives each candidate a vote, only then does it jump to the next voter and the whole thing repeats.
You have to figure out how to only give the voters first choice etc. a vote, as long as their not eliminated and then move to the next voter. It's a minor thing. An option would be to, once you add the vote to that specific candidate, stop the loop so that it can go to the next voter and so on. That will also make the `else` argument unnecessary.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6324056,"math_prob":0.9659421,"size":1968,"snap":"2020-45-2020-50","text_gpt3_token_len":521,"char_repetition_ratio":0.200611,"word_repetition_ratio":0.19504644,"special_character_ratio":0.31300813,"punctuation_ratio":0.15497077,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9880216,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-10-23T11:59:38Z\",\"WARC-Record-ID\":\"<urn:uuid:f3551f28-2268-44e9-942c-f9edca10749a>\",\"Content-Length\":\"119338\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:aab30713-f2c7-4cee-be1c-d29468631bc7>\",\"WARC-Concurrent-To\":\"<urn:uuid:af40ddd1-83fb-4368-b8dd-b0bc0e7929de>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://cs50.stackexchange.com/questions/39184/my-runoff-problem-doesnt-pass-check50\",\"WARC-Payload-Digest\":\"sha1:AKSMVU7MQ5K4TP6L345TOI53NJH66UEY\",\"WARC-Block-Digest\":\"sha1:GYATNRQBIFYRDT7MNLVBU4KMS2Q7MGBP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-45/CC-MAIN-2020-45_segments_1603107881369.4_warc_CC-MAIN-20201023102435-20201023132435-00641.warc.gz\"}"}