1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <iostream>
#include <string>
using namespace std;
string ordinal[] = { "", "first", "second", "third", "fourth", "fifth", "sixth",
"seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth" };
string gift[] = { "",
"A partridge in a pear tree." ,
"Two turtle doves and" ,
"Three french hens," ,
"Four calling birds," ,
"Five gold rings," ,
"Six geese a-laying," ,
"Seven swans a-swimming," ,
"Eight maids a-milking," ,
"Nine ladies dancing," ,
"Ten lords a-leaping," ,
"Eleven pipers piping," ,
"Twelve drummers drumming," };
string what( int i )
{
return ( i ? gift[i] + "\n" + what( i - 1 ) : "\n" );
}
string when( int i )
{
return ( 13 - i ? "On the " + ordinal[i] + " day of Christmas my true love sent to me:\n" + what( i ) + when( i + 1 ) : "\n" );
}
int main()
{
cout << when( 1 );
}
|