///////////////////////////////////////////////////
// xmas12: a compound gift determiner            //
//                                               //
// Author: Rami Kuttaineh                        //
//         rami.kuttaineh at gmail.com           //
//                                               //
// ANSWERS the question: how many gifts are      //
// given in the carol `THE 12 DAYS OF CHRISTMAS' //
///////////////////////////////////////////////////

#include <iostream>

typedef int day;

int main()
{
        day span[12] = {1};   // subtotal array

// Fill the array:

        int gift = 1;
        day date = 0;

        while( date < 12 )
        {
                ++date;
                ++gift;

                span[date] = gift + span[(date-1)];
        }

// Add datespan subtotals:

        int total = 0;

        for(day i=0; i < 12; i++ )
                total += span[i];

        std::cout << "There are " << total << " gifts given." << std::endl;
        system("PAUSE");  // so this can be executed from Start > Run:
        return 0;
}