Here's a sample C code that creates 20 different teams for Dream11. Note that this is just an example and the actual code for creating Dream11 teams may vary depending on the specific requirements of the game.
CODE IS HERE : copy the below code.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define NUM_PLAYERS 11
#define NUM_TEAMS 20
int main() {
// Players and their ratings
char players[NUM_PLAYERS][20] = {
"Player1", "Player2", "Player3", "Player4", "Player5",
"Player6", "Player7", "Player8", "Player9", "Player10", "Player11"
};
int ratings[NUM_PLAYERS] = {80, 85, 90, 85, 90, 75, 80, 85, 90, 85, 90};
// Seed the random number generator
srand(time(NULL));
// Create 20 different teams
for (int i = 1; i <= NUM_TEAMS; i++) {
printf("Team %d:\n", i);
int total_rating = 0;
int team[NUM_PLAYERS] = {0};
// Select players randomly
while (total_rating < 1000) {
int player = rand() % NUM_PLAYERS;
if (team[player] == 0) {
team[player] = 1;
printf("%s (%d)\n", players[player], ratings[player]);
total_rating += ratings[player];
}
}
printf("\n");
}
return 0;
}
In this code, we define an array of player names and their corresponding ratings. We also define constants for the number of players and teams we want to create.
We then seed the random number generator and use a loop to create 20 different teams. For each team, we select players randomly until their total rating is at least 1000. We print out the names and ratings of the selected players, and then move on to the next team.
Note that this code is just a simple example, and there are many ways to modify it to suit the specific requirements of the Dream11 game.
Social Plugin