Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Pokedex_Assignment
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
a-j.towse
Pokedex_Assignment
Commits
61348d37
Commit
61348d37
authored
Jan 04, 2023
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All functions working
parent
7518d06b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
main
main
+0
-0
main.c
main.c
+24
-3
No files found.
main
View file @
61348d37
No preview for this file type
main.c
View file @
61348d37
...
...
@@ -49,7 +49,7 @@ struct PlayerNode * FindPlayer(struct Pokedex pokedex, char name[]);
//Define functions for other functionality
void
AddPokemonToPlayer
(
struct
Pokedex
pokedex
,
char
playerName
[],
char
pokemonName
[]);
void
DisplayPokemonDetails
(
struct
Pokedex
pokedex
,
char
name
[]);
void
Di
playPlayerDetails
(
struct
Pokedex
pokedex
,
char
name
);
void
Di
splayPlayerDetails
(
struct
Pokedex
pokedex
,
char
name
[]
);
void
ListPokemon
(
struct
Pokedex
pokedex
);
void
ListPlayers
(
struct
Pokedex
pokedex
);
...
...
@@ -85,6 +85,11 @@ int main (void) {
ListPlayers
(
pokedex
);
AddPokemonToPlayer
(
pokedex
,
"Joe"
,
"Charmander"
);
AddPokemonToPlayer
(
pokedex
,
"Joe"
,
"Squirtle"
);
DisplayPokemonDetails
(
pokedex
,
"Charmander"
);
DisplayPlayerDetails
(
pokedex
,
"Joe"
);
return
0
;
}
...
...
@@ -250,7 +255,7 @@ void AddPokemonToPlayer(struct Pokedex pokedex, char playerName[], char pokemonN
return
;
}
for
(
int
i
=
0
;
1
<
playerAdd
->
pokemonCount
;
i
++
)
{
for
(
int
i
=
0
;
i
<
playerAdd
->
pokemonCount
;
i
++
)
{
if
(
playerAdd
->
pokemonArray
[
i
]
==
pokemonAdd
){
return
;
...
...
@@ -262,5 +267,21 @@ void AddPokemonToPlayer(struct Pokedex pokedex, char playerName[], char pokemonN
}
void
DisplayPokemonDetails
(
struct
Pokedex
pokedex
,
char
name
[])
{
PokemonNode
*
pokemonAdd
=
FindPokemon
(
pokedex
,
name
);
printf
(
"Name: %s
\n
"
"
\t
Type: %s
\n
"
"
\t
Ability: %s
\n
"
,
pokemonAdd
->
name
,
pokemonAdd
->
type
,
pokemonAdd
->
ability
);
}
void
DisplayPlayerDetails
(
struct
Pokedex
pokedex
,
char
name
[])
{
PlayerNode
*
playerAdd
=
FindPlayer
(
pokedex
,
name
);
printf
(
"Name: %s
\n
"
"
\t
Pokemon Count: %i
\n
"
"
\t
Pokemon Owned: "
,
playerAdd
->
name
,
playerAdd
->
pokemonCount
);
for
(
int
i
=
0
;
i
<
playerAdd
->
pokemonCount
;
i
++
)
{
printf
(
"
\t\t
%s,"
,
playerAdd
->
pokemonArray
[
i
]
->
name
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment