food_chain: 3-column table

This commit is contained in:
Dmitry Kokorin 2016-02-29 14:56:08 +03:00
parent a249e71851
commit c80a6294e1

View file

@ -6,39 +6,33 @@ namespace food_chain {
using namespace std; using namespace std;
#define ANIMAL_TABLE \ #define ANIMAL_TABLE \
X(Fly, "fly") \ X(Fly, "fly", "") \
X(Spider, "spider") \ X(Spider, "spider", "It wriggled and jiggled and tickled inside her.\n") \
X(Bird, "bird") \ X(Bird, "bird", "How absurd to swallow a bird!\n") \
X(Cat, "cat") \ X(Cat, "cat", "Imagine that, to swallow a cat!\n") \
X(Dog, "dog") \ X(Dog, "dog", "What a hog, to swallow a dog!\n") \
X(Goat, "goat") \ X(Goat, "goat", "Just opened her throat and swallowed a goat!\n") \
X(Cow, "cow") \ X(Cow, "cow", "I don't know how she swallowed a cow!\n") \
X(Horse, "horse") X(Horse, "horse", "She's dead, of course!\n")
#define X(a, b) a, #define X(a, b, c) a,
enum Animal { enum Animal {
ANIMAL_TABLE ANIMAL_TABLE
}; };
#undef X #undef X
#define X(a, b) b, #define X(a, b, c) b,
static const char *animal_name[] = { static const char *animal_name[] = {
ANIMAL_TABLE ANIMAL_TABLE
}; };
#undef X #undef X
#define X(a, b, c) c,
static const char *verse_phrase[] = { static const char *verse_phrase[] = {
"", ANIMAL_TABLE
"It wriggled and jiggled and tickled inside her.\n",
"How absurd to swallow a bird!\n",
"Imagine that, to swallow a cat!\n",
"What a hog, to swallow a dog!\n",
"Just opened her throat and swallowed a goat!\n",
"I don't know how she swallowed a cow!\n",
"She's dead, of course!\n"
}; };
#undef X
string verse(int index) string verse(int index)