Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pokedex
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
jamilah.hamade
pokedex
Commits
4b62ef45
Commit
4b62ef45
authored
Jan 24, 2022
by
jamilah.hamade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parents
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
0 deletions
+110
-0
c
c
+110
-0
No files found.
c
0 → 100644
View file @
4b62ef45
#include <stdio.h>
#include <stdlib.h>
typedef struct PokemonNode { //struct created for PokemonNode
char Name[10]; //name of pokemon that can't exceed 10 characters.
char Type[10]; // type of pokemon that can't exceed 10 characters.
char Ability [50];// pokemon's ability, max of 50 characters.
struct PokemonNode * next; //pointer to next PokemonNode
}; PokemonNode;
typedef struct PlayerNode {
char PlayerName[10]; //player's name, can't exceed 10 characters.
int Pokemonsowned; // number of pokemon's owned by player.
// an array of pointers to the pokemons owned by each player
struct PlayerNode * next; // Pointer to next PlayerNode
}; PlayerNode;
struct Pokedox {
//two pointers – one to the head of the player list and one to the head of the Pokemon list.
};
int main() {
printf("Hello, enter one of the following numbers\n1.Display Pokemon list\n2.Display player list\n3.Add new pokemon\n4.Add new player\n" );
int a ;
scanf("%d", &a); //check which option user entered
struct PokemonNode * head = NULL; //head of pokemon list created
struct PokemonNode * NewPokemonNode1(char Spectrier, char Ghost, char Grim_Neigh);
struct PokemonNode * NewPokemonNode2(char Glastrier, char Ice, char Chilling_Neigh);
struct PokemonNode * NewPokemonNode3(char Zacian, char Fairy, char Intrepid_Sword);
if (a == 1){
//Pokemon list
printf("Pokemon1: name: Spectrier, type: Ghost, primary ability: Grim Neigh \n Pokemon2: name: Glastrier, type: Ice, primary ability: Chilling Neigh \n Pokemon3: name: Zacian , type: Fairy, primary ability: Intrepid Sword \n" );
}
else if (a == 2) {
struct PlayerNode * head = NULL; //head of player list created
struct PlayerNode * NewPlayerNode1(char Vera, int [2]);
struct PlayerNode * NewPlayerNode2(char Mateo, int [1]);
printf("Player 1: name: Vera, number of pokemon owned: 2 \n Player 2: name: Mateo, number of pokemon owned: 1 \n" );
}
else if (a == 3){
printf("Insert new Pokemon name:\n" );
void AddPokemonToList(*pokedox,name,type,ability);
char b;
scanf("%s",&b);
printf("\n %s is added to pokemon list\n", &b);
return 0;
}
else if (a == 4){
void AddPlayerToList(*pokedox,name);
printf("Insert new player's name:\n" );
char c;
scanf("%s", &c);
printf("\n %s is added to player list\n",&c );
return 0;
}
}
\ 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