beer_song: cleanup
This commit is contained in:
parent
bc8abe0d53
commit
cad1ffad7d
1 changed files with 6 additions and 6 deletions
|
|
@ -12,13 +12,13 @@ string verse(int index)
|
||||||
auto count_str = [](int count) -> string {
|
auto count_str = [](int count) -> string {
|
||||||
|
|
||||||
if (0 == count)
|
if (0 == count)
|
||||||
return "no more bottles ";
|
return "no more bottles";
|
||||||
|
|
||||||
if (1 == count)
|
if (1 == count)
|
||||||
return "1 bottle ";
|
return "1 bottle";
|
||||||
|
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
oss << count << " bottles ";
|
oss << count << " bottles";
|
||||||
|
|
||||||
return oss.str();
|
return oss.str();
|
||||||
};
|
};
|
||||||
|
|
@ -31,15 +31,15 @@ string verse(int index)
|
||||||
};
|
};
|
||||||
|
|
||||||
return capitalize_first(count_str(index))
|
return capitalize_first(count_str(index))
|
||||||
+ "of beer on the wall, "
|
+ " of beer on the wall, "
|
||||||
+ count_str(index)
|
+ count_str(index)
|
||||||
+ "of beer.\n"
|
+ " of beer.\n"
|
||||||
+ (index ? string("Take ")
|
+ (index ? string("Take ")
|
||||||
+ (index == 1 ? "it" : "one")
|
+ (index == 1 ? "it" : "one")
|
||||||
+ " down and pass it around, "
|
+ " down and pass it around, "
|
||||||
: string("Go to the store and buy some more, "))
|
: string("Go to the store and buy some more, "))
|
||||||
+ count_str(index ? index - 1 : 99)
|
+ count_str(index ? index - 1 : 99)
|
||||||
+ "of beer on the wall.\n";
|
+ " of beer on the wall.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string sing(int from_index, int to_index)
|
string sing(int from_index, int to_index)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue