I am pretty new to c++ and I am trying to implement an efficient sorting algorithm. I want this to also work for four players but at the moment I am testing my program for 2 players. Each player has a goals and balls and an id. If for example player 1 has more goals than player 2 player two is the winner. If player 1 and player 2 have the same amount of goals then the player with the most amount of balls is the winner. If player 1 and player 2 have the same amount of goals and balls then the player with the highest id wins.
This is what I have come up with if there are two players. It's a pretty long if.
If there are 3 or 4 players I would end up with way to many if clauses which would make my code unreadable ?
Is there a more efficient way to do this?
I would really want to know since I plan to do it with three and four players.

in my example player with id 2 would win since both of them have the same amount of goals but player with id: 2 has more balls.

Code:
results[2]; // array or vector of type int
players[0].goals = 4;
players[0].balls = 3;
players[0].id = 1;
players[1].goals = 4;
players[1].balls = 4;
players[1].id = 2;

if(players[0].goals > players[1].goals) {
    results[0] = players[0].id;
    results[1] = players[1].id;
}
else if(players[1].goals > players[0].goals) {
    results[0] = players[1].id;
    results[1] = players[0].id;
}
if(players[0].goals == players[1].goals) {
    if(players[0].balls > players[1].balls) {
        results[0] = players[0].id;
        results[1] = players[1].id;
    }
    else if(players[1].balls > players[0].balls) {
        results[0] = players[1].id;
        results[1] = players[0].id;
    }
    else if(players[0].balls == players[1].balls) {
        if(players[0].id > players[1].id) {
            results[0] = players[0].id;
            results[1] = players[1].id;
        }
        else {
             results[0] = players[1].id;
            results[1] = players[0].id;
        }
       
    }
}