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