/***************************************************************************** * structs.c * CSCI E-52 * Matthew Chartier * * Declaring and using structs ****************************************************************************/ #include #include #include typedef struct { char *name; char *type; int hp; } pokemon; void print_pokemon(pokemon poke) { printf("Your Starter Pokemon\n"); printf("--------------------\n"); printf("Name: %s\n", poke.name); printf("Type: %s\n", poke.type); printf("HP: %d\n\n", poke.hp); } int main(int argc, char *argv[]) { pokemon starter; //Get Pokemon's name printf("Which pokemon do you want?\n>> "); starter.name = GetString(); //Get Pokemon's type printf("Err... Which type is that pokemon again?\n>> "); starter.type = GetString(); //In the interests of game balance starter.hp = 20; //Show info about pokemon print_pokemon(starter); //Judgment check if (strcmp("Charmander", starter.name) == 0) printf("You chose wisely!\n"); else printf("Not Charmander? Really? Good luck, n00b...\n"); return 0; }