#include "animals.h" // I always include iostream, I may want to do output when debugging #include // this is only for this compile unit, so it is not a problem. using namespace std; std::string AnimalTToString(AnimalT a){ switch(a) { case CHICKEN: return "chicken"; case DOG: return "dog"; case CAT: return "cat"; case RABBIT: return "rabbit"; case HORSE: return "horse"; case GOAT: return "goat"; case COW: return "cow"; case FISH: return "fish"; case TURTLE: return "turtle"; case SNAKE: return "snake"; case DUCK: return "duck"; case UNKNOWN: default: return "UNKNOWN"; } } AnimalT StringToAnimalT(std::string s){ size_t i; for(i=0;i FIRST_ANIMAL) { a = AnimalT(int(a) - 1); } return a; } AnimalT RandomAnimalT(void){ return AnimalT(drand48()* int(LAST_ANIMAL- FIRST_ANIMAL)); }