Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- void MostrarPokemon(int n);
- typedef struct habilidades{//La estructura de los ataques
- char tipo_habilidad[15];
- int danio;
- int PP;
- char efecto[15];
- int prob_efect;//QUEREMOS INCLUIR 4 ATAQUES A CADA UNO DE NUESTROS POKEMONES, LUEGO IMPRIMIRLOS AL ELEGIR AL POKEMON QUERIDO
- }ataques;
- typedef struct pokemon{
- char nombre[15];
- char tipo[15]; //Definimos una estructura llamada pokemon
- int vida;
- int num_habilidades;
- ataques ataque_pokemon;
- }pokemon;
- void ElegirPokemon(pokemon* pj);
- void MostrarPokemonElegido(pokemon pj);
- struct pokemon lista[10]; //Definimos una estructura type pokemon que sea una lista de n(10 en este caso) pokemon, PODEMOS AUMENTAR EL NUMERO DE POKEMONES QUE QUEREMOS
- struct pokemon lista[10]={{"Pikachu","Electrico",300,4},
- {"Bulbasaur","Planta",350,4},{"Charizard","Fuego",500,4},//Le entregamos valores a cada una de nuestras estructuras de la lista
- {"Glaceon","Hielo",400,4},{"Caterpie","Bicho",5000,4},
- {"Squirtle","Agua",350,4}
- };
- int main(){
- pokemon *pj1b,pj1;
- pj1b = &pj1;
- MostrarPokemon(6);
- ElegirPokemon(pj1b);
- MostrarPokemonElegido(pj1);
- return 0;
- }
- void MostrarPokemon(int n){//Funcion que muestra los pokemones que se pueden elegir
- printf("Los pokemones que puede elegir son: \n\n");
- for(n=0;n<6;n++){
- printf("%d.-\nPokemon: %s tipo: %s \nVida: %d \n\n", n, lista[n].nombre, lista[n].tipo,lista[n].vida);
- }
- return;
- }
- void ElegirPokemon(pokemon* pj){
- int n;
- printf("\n\n\nIngrese el numero del pokemon que quiere escoger:\n");
- scanf("%d",&n);
- *pj = lista[n];
- /*printf("el pokemon que usted ha elegido es: \n");
- printf("%s\n",lista[n].nombre );
- printf("Tipo: %s\n",lista[n].tipo);
- printf("vida: %d\n",lista[n].vida);*/
- }
- void MostrarPokemonElegido(pokemon pj){
- printf("\nPokemon: %s tipo: %s \nVida: %d \n\n", pj.nombre, pj.tipo,pj.vida);
- }
- /*int resPP(){
- }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement