00:01
In this question, we have to create a c+ + program and using that, we will create a game that manages football players.
00:11
Now let's jump straight towards the code.
00:17
This is the c+ + compiler.
00:19
First we will include the basic libraries.
00:25
So by using string, fstream and iostream, we will then create some constants.
00:42
So these are the some constants.
00:44
We have used standard library to use this string data type and storing it in file name.
00:55
Then here is the max players.
00:57
After that, we will create our first structure struct player.
01:02
So how the node of power our player will look like.
01:06
So we are going to have a player of data type struct.
01:10
Inside that we will have touchdowns, catches, passing yards, receiving yards, rushing yards.
01:16
Now these all the parameters of the game and here is the name of a player in a string format and position of player also in string format.
01:27
After creating that node, we will create a function to input data for a player.
01:34
Now in this, we have to create some parameters which will be for players.
01:50
Now we will pass a parameter player of data type player that this struct data type we will pass a parameter player.
02:03
Now in order to take input data of player, we will first display the name, then we will take input and position, then we will take input.
02:12
So we are basically filling these variables using these functions.
02:18
So this will be different for player one, player two, but the structure will remain same for all the players.
02:23
After taking the input data, what we will do is we will, we have to get a function that outputs the data of player.
02:36
So again, here we have taken a parameter to let our function know which player is this.
02:45
After that, we will print some values.
02:51
So these are the same values that a player has stored in a struct data type.
02:59
Now after creating this basic functions, we will create a function to search for a player's index by name.
03:06
Okay, so like in some games, we send friend request or to search a particular player in order to play with him or her.
03:17
Similarly, we will create a find player index.
03:24
So using this function, we can find the number of number of players in this array.
03:36
So if player in this array is equal to the name that we want, then we will return that player.
03:44
So we have passed name as a constant, total number of players for this for loop limitation and array of the player.
03:56
So from this array, we will run loop till this limit in order to extract this name.
04:05
After searching for the players, we will create some more functions to update the touchdowns, to update the catches, to update the yards, receiving yards.
04:18
So in order to update different different parameters in the game, we have to create some more updating functions.
04:28
So these are some functions for updating the parameters.
04:39
So here we have update catches.
04:41
So for a particular player, if we like this, we'll take the catches.
04:49
Similarly with updating yards, updating, sorry, receiving yards, then updating rushing.
04:56
Now till now we have created a player.
04:59
We have taken his or her details.
05:03
We have defined the structure in the creation of player.
05:09
Then we have a function to find a particular player to play with.
05:14
Then we have some updating functions to update the runs, catches, etc.
05:19
Of the player.
05:21
Now we have to save all these parameters somewhere...