Answer to Question #281123 in C++ for Adnan

Question #281123

Write a program that helps teams in a league pick new players for the coming 2021 season. League has a total of 4 teams where each team can have a maximum of 16 players.

1. Get the number of players to enlist in the draft and store their information For a batsman bowling average and strike rate should be set to -1, and vice virsa.

2.Reorganize the player information on the basis of their expertise. Only allocate memory required to store players’ data separately (batsman bowler and allrounder).

3 Assign ranking on the basis of random number

4.To calculate how many new players each team can buy in the draft.

5.Each team will be asked to tell the number of players they want to retain out of 16. R cannot be less than 7 and greater than 11.

6.New players they can have will be total players minus the players they want to retain (16 – R)

7.Player selection function where each team chooses their pick one by one. Once a player is picked by a team change his status to false


1
Expert's answer
2021-12-20T09:54:34-0500
#include <bits/stdc++.h>


using namespace std;


double batsman(int runs, int matches, int outt)
{
    int out = matches - outt;


    if (out == 0)
        return -1;


    double avg = double(runs) / out;


    return avg;
}


struct Player
{
    string name;
    int rank;
};



int main()
{
    int runs = 2500;
    int matches = 100;
    int outt = 30;


    double avg = batsman(runs, matches, outt);


    if (avg == -1)
        cout << "NO\n";
    else
        cout << avg;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog