dimanche 5 juillet 2020

how can i eliminate an integer using an if condition?

if i created a 'for loop' like this:

candidate_count = get_int("\n");

for ( int i = 0; i < candidate_count; i++)

along with this struct:

typedef struct
{
    string name;
    int votes;
    bool eliminated;
}
candidate;

how can i eliminate the smallest integer (along with everything else (name, votes)) between them using an 'if condition'?

*what i want to do is something like this:

if(candidates[i].votes < //rest of the candidates)  
{
     //eliminate candidates[i].votes
}

Aucun commentaire:

Enregistrer un commentaire