@@ -12,23 +12,21 @@ std::string verse(int day) {
1212 " seventh" , " eighth" , " ninth" , " tenth" , " eleventh" , " twelfth" };
1313
1414 constexpr std::array gifts = {" " ,
15- " a Partridge in a Pear Tree" ,
16- " two Turtle Doves" ,
17- " three French Hens" ,
18- " four Calling Birds" ,
19- " five Gold Rings" ,
20- " six Geese-a-Laying" ,
21- " seven Swans-a-Swimming" ,
22- " eight Maids-a-Milking" ,
23- " nine Ladies Dancing" ,
24- " ten Lords-a-Leaping" ,
25- " eleven Pipers Piping" ,
26- " twelve Drummers Drumming" };
27-
28- auto result = std::string{" On the " } +
29- ordinals[day] +
30- " day of Christmas my true love gave to me: " +
31- gifts[day];
15+ " a Partridge in a Pear Tree" ,
16+ " two Turtle Doves" ,
17+ " three French Hens" ,
18+ " four Calling Birds" ,
19+ " five Gold Rings" ,
20+ " six Geese-a-Laying" ,
21+ " seven Swans-a-Swimming" ,
22+ " eight Maids-a-Milking" ,
23+ " nine Ladies Dancing" ,
24+ " ten Lords-a-Leaping" ,
25+ " eleven Pipers Piping" ,
26+ " twelve Drummers Drumming" };
27+
28+ auto result = std::string{" On the " } + ordinals[day] +
29+ " day of Christmas my true love gave to me: " + gifts[day];
3230
3331 for (int i = day - 1 ; i >= 1 ; --i) {
3432 if (i == 1 ) {
@@ -38,10 +36,10 @@ std::string verse(int day) {
3836 }
3937 result += gifts[i];
4038 }
41-
39+
4240 return result + " .\n " ;
4341}
44- }
42+ } // namespace
4543
4644std::string recite (int start_day, int end_day) {
4745 std::string result{};
@@ -51,7 +49,7 @@ std::string recite(int start_day, int end_day) {
5149 }
5250 result += verse (i);
5351 }
54- return result;
52+ return result;
5553}
5654
5755} // namespace twelve_days
0 commit comments