0

I'm a beginner and CS50 is the first coding experience I have. Like the title says, my code works when I test it but the CS50 won't accept it so I'm not sure what's wrong. Thanks for any help!

ps. I can add the whole code if necessary. Didn't want to clog the question if it wasn't.

void print_winner(int voter_count)





win = 0;
int w = 0;


for (w = 0; w<voter_count; w++)
{
    if (candidates[w].votes>win)
    win = candidates[w].votes;

}

for(int j = 0; j<voter_count; j++)
if(win == candidates[j].votes)
{
 printf("%s\n", candidates[j].name);
}
return;

}

0

One instruccions for the exercise is that you can't modify anything in the file except the implementations of the vote() and print_winner() functions. That includes the headers too.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .