Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
c_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
elijah vasquez
c_pokedex_assignment
Commits
0dbf6af5
Commit
0dbf6af5
authored
Jan 16, 2023
by
elijah vasquez
🦍
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commitidk
parent
2d99774c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
26 deletions
+46
-26
settings.json
.vscode/settings.json
+2
-1
functions.exe
functions.exe
+0
-0
functions.h
functions.h
+16
-17
main.c
main.c
+26
-8
main.exe
main.exe
+0
-0
tempCodeRunnerFile.h
tempCodeRunnerFile.h
+2
-0
No files found.
.vscode/settings.json
View file @
0dbf6af5
{
"files.associations"
:
{
"functions.h"
:
"c"
,
"typeinfo"
:
"c"
"typeinfo"
:
"c"
,
"stdbool.h"
:
"c"
}
}
\ No newline at end of file
functions.exe
0 → 100644
View file @
0dbf6af5
File added
functions.h
View file @
0dbf6af5
// Pokemon List
typedef
struct
PokemonNode
{
char
name
[
20
];
char
name
[
12
];
char
type
[
20
];
char
ability
[
30
];
char
ability
[
25
];
struct
PokemonNode
*
next
;
}
PokemonNode
;
// Player List
typedef
struct
PlayerNode
{
char
name
[
50
];
char
name
[
25
];
int
totalPokemon
;
PokemonNode
*
PokemonArray
[
20
];
PokemonNode
*
PokemonArray
[
20
];
struct
PlayerNode
*
next
;
}
PlayerNode
;
...
...
@@ -26,21 +25,21 @@ typedef struct Pokedex
// Pokemon List functions
PokemonNode
*
NewPokemonNode
(
char
name
[
20
],
char
type
[
20
],
char
ability
[
30
]);
void
AddPokemonToList
(
Pokedex
**
pokedex
,
char
name
[
20
],
char
type
[
20
],
char
ability
[
30
]);
PokemonNode
*
FindPokemon
(
Pokedex
pokedex
,
char
name
[
20
]);
PokemonNode
*
NewPokemonNode
(
Pokedex
*
pokedex
,
char
name
[
25
],
char
type
[
25
],
char
ability
[
30
]);
void
AddPokemonToList
(
Pokedex
**
pokedex
,
char
name
[
25
],
char
type
[
25
],
char
ability
[
30
]);
PokemonNode
*
FindPokemon
(
Pokedex
*
pokedex
,
char
name
[
25
]);
// Player List functions
PlayerNode
*
NewPlayerNode
(
char
name
[
50
]);
void
AddPlayerToList
(
Pokedex
*
pokedex
,
char
name
[
50
]);
PlayerNode
*
FindPlayer
(
Pokedex
pokedex
,
char
name
[
50
]);
PlayerNode
*
NewPlayerNode
(
char
name
[
50
]);
// Create new node, return pointer to node
void
AddPlayerToList
(
Pokedex
*
pokedex
,
char
name
[
50
]);
// Check if name already exists in Player list.
PlayerNode
*
FindPlayer
(
Pokedex
*
pokedex
,
char
name
[
50
]);
// Searches Player list for name.
// Additional functions
void
AddPokemonToPlayer
(
Pokedex
pokedex
,
char
playerName
[
50
],
char
pokemonName
[
20
]);
void
DisplayPokemonDetails
(
Pokedex
*
pokedex
,
char
name
[
20
]);
void
DisplayPlayerDetails
(
Pokedex
*
pokedex
,
char
name
[
50
]);
void
ListPokemon
(
Pokedex
*
pokedex
);
void
ListPlayers
(
Pokedex
*
pokedex
);
void
AddToPokemonArray
(
Pokedex
*
pokedex
,
char
namePoke
[
20
],
char
namePlayer
[
50
]);
void
AddPokemonToPlayer
(
Pokedex
*
pokedex
,
char
playerName
[
50
],
char
pokemonName
[
20
]);
// Adds Pokemon to player's Pokemon list
void
DisplayPokemonDetails
(
Pokedex
*
pokedex
,
char
name
[
20
]);
// Output details of pokemon
void
DisplayPlayerDetails
(
Pokedex
*
pokedex
,
char
name
[
20
]);
// output details of players, incl. list of names of pokemon owned
void
ListPokemon
(
Pokedex
*
pokedex
);
//output list of names of all POKEMON in pokedex
void
ListPlayers
(
Pokedex
*
pokedex
);
//output list of names of all PLAYERS in pokedex
void
AddToPokemonArray
(
Pokedex
*
pokedex
,
char
namePoke
[
20
],
char
namePlayer
[
50
]);
main.c
View file @
0dbf6af5
...
...
@@ -6,17 +6,35 @@
int
main
(
void
)
{
Pokedex
*
pokedex
Node
=
NULL
;
pokedex
Node
=
malloc
(
sizeof
(
struct
PokemonNode
));
pokedex
Node
->
pokemonNodehead
=
NULL
;
pokedex
Node
->
PlayerNodehead
=
NULL
;
Pokedex
*
pokedex
=
NULL
;
pokedex
=
malloc
(
sizeof
(
pokedex
));
pokedex
->
pokemonNodehead
=
NULL
;
pokedex
->
PlayerNodehead
=
NULL
;
// Calling functs. to create list of Pokemon
// Calling functs. to create list of players
// Adding Pokemon to list
AddPokemonToList
(
&
pokedex
,
"blastoise"
,
"water"
,
"torrent"
);
AddPokemonToList
(
&
pokedex
,
"dragapult"
,
"dragon"
,
"infiltrator"
);
AddPokemonToList
(
&
pokedex
,
"volcarona"
,
"fire"
,
"flame body"
);
AddPokemonToList
(
&
pokedex
,
"regieleki"
,
"electric"
,
"transistor"
);
// Adding player to player list
AddPlayerToList
(
&
pokedex
,
"armin"
);
AddPlayerToList
(
&
pokedex
,
"chase"
);
AddPlayerToList
(
&
pokedex
,
"ziggy"
);
// Adding pokemon to player
AddPokemonToPlayer
(
pokedex
,
"armin"
,
"blastoise"
);
AddPokemonToPlayer
(
pokedex
,
"armin"
,
"dragapult"
);
AddPokemonToPlayer
(
pokedex
,
"chase"
,
"dragapult"
);
AddPokemonToPlayer
(
pokedex
,
"chase"
,
"regieleki"
);
AddPokemonToPlayer
(
pokedex
,
"chase"
,
"volcarona"
);
AddPokemonToPlayer
(
pokedex
,
"ziggy"
,
"regieleki"
);
ListPokemon
(
pokedex
);
ListPlayers
(
pokedex
);
}
return
0
;
}
main.exe
deleted
100644 → 0
View file @
2d99774c
File deleted
tempCodeRunnerFile.h
0 → 100644
View file @
0dbf6af5
har
name
[
20
]);
void
DisplayPlayerDetails
(
Pokedex
*
pokedex
,
ch
\ No newline at end of file
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