#include<iostream>
using namespace std;
int main()
{
int dayLimit, dayCount=1;
string dayString;
// Get day to count up to
cout << "What day will we count up to? ";
cin >> dayLimit;
// Loop up from first day to day limit
// selected by user
while(dayCount<=dayLimit)
{
// Pick word corresponding to day
switch(dayCount) {
case 12 :
dayString="twelth";
break;
case 11 :
dayString="eleventh";
break;
case 10 :
dayString="tenth";
break;
case 9 :
dayString="ninth";
break;
case 8 :
dayString="eighth";
break;
case 7 :
dayString="seventh";
break;
case 6 :
dayString="sixth";
break;
case 5 :
dayString="fifth";
break;
case 4 :
dayString="fourth";
break;
case 3 :
dayString="third";
break;
case 2 :
dayString="second";
break;
case 1 :
dayString="first";
break;
}
// Announce the day
cout << "On the " << dayString
<< " day of Christmas, my true love gave to me\n";
// List the gifts
switch(dayCount)
{
case 1 :
cout << "a partridge in a pear tree\n";
break;
case 12 :
cout << "12 drummers drumming\n";
case 11 :
cout << "11 pipers piping\n";
case 10 :
cout << "10 lords a-leaping\n";
case 9 :
cout << "9 ladies dancing\n";
case 8 :
cout << "8 maids a-milking\n";
case 7 :
cout << "7 swans a-swimming\n";
case 6 :
cout << "6 geese a-laying\n";
case 5:
cout << "5 golden rings\n";
case 4:
cout << "4 calling birds\n";
case 3:
cout << "3 french hens\n";
case 2:
cout << "2 turtles doves\nand a partidge in a pear tree\n";
}
// Increase the day for the next loop repetition
dayCount++;
}
}