//12days.c --- godmessage in plain text -- by tsaiwn@csie.nctu.edu.tw char *num[ ]={"a","two","three", "four", "five", "six", "seven","eight", "nine", "ten", "eleven", "twelve"},*days[38]={"first","second","third", "fourth","fifth","sixth" ,"seventh","eight","ninth","tenth","eleventh","twelth"}, *some[ ]={"Drummers drumming","Pipers piping", "Lords a-leaping","Ladies" " danching", "Maids a-milking", "Swans a-swiming","Gees a-laying","Gold rings", "Calling birds", "French hens","Turtle doves", "Partridge in a pear tree"}; void fun(i, k){if(i==12)return; if(k==i)printf( "\nOn the %s day of Christmas my true love sent to me\n",days[i]); printf("%s%s %s%s%s", (i>0)&&(k==0)?"\nand ":"", num[k],some[11-k], k==0?".\n":", ", (k==4 || k==6 || k==9) ?"\n":""); k>0? fun(i,k-1):fun(i+1,i+1); } void main( ) {fun(0,0); system("explorer http://www.csie.nctu.edu.tw/~tsaiwn/introcs/12days.htm"); #ifdef __TURBOC__ printf(" ... happy new year .. You are using Turbo C++ ..."); #endif #ifdef __GNUC__ printf(" Happy Christmas! .. you are using gcc.."); #endif getchar( );}