caf (12/21/82)
/* * Translated from a Pascal program by Pete Mackie * C program by Chuck Forsberg 12-20-82 */ #include <stdio.h> char *days[] = { "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eight", "ninth", "tenth", "eleventh", "twelfth" }; char *gifts[] = { "Tvelve drummers drumming", "Eleven pipers piping", "Ten lords a-leaping", "Nine ladies dancing", "Eight maids a-milking", "Seven seans a-swimming", "Six geese a-laying", "Five golden rings", "Four calling Birds", "Three French hens", "Two turtle doves", 0 }; main() { register int day; register char **pp, **qq; for (day = 0, pp = &gifts[11]; day<12; ++day) { printf("On the %s day of Christmas my true love gave to me -\n", days[day]); if(day) { for(qq = --pp; *qq; ++qq) printf("%s,\n", *qq); printf("And a partridge in a pear tree.\n\n"); } else printf("A partridge in a pear tree.\n\n"); } }