bool vote(int voter, int rank, string name)
    for(int n = 0; n == candidate_count - 1; n++)
        if(strcmp(name, candidates[n].name) == 0)
            n = preferences[voter][rank];
            return true;

    return false;

as far as i know the funcion should end when return true; happens, but anyway the result is false

EDIT: After some rounds of debug50 i discovered that the for loop isnt even starting, wich makes the problem even deeper for me.


The test condition must be true for the loop to run. Perhaps it should be n < candidate_count - 1;?

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

| improve this answer | |

You must log in to answer this question.

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