The Twelve Days of Christmas: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1,608:
Two turtle doves and
A partridge in a pear tree.</pre>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
 
 
<syntaxhighlight lang="Delphi">
 
 
const GiftList: array [0..11] of string =(
'a partridge in a pear tree.',
'Two turtle doves',
'Three french hens',
'Four calling birds',
'Five golden 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');
 
const Cardinals: array [0..11] of string =
('first','second','third','forth',
'fifth','sixth','seventh','eight',
'ninth','tenth','eleventh','twelfth');
 
procedure DoOneDay(Memo: TMemo; Day: integer);
var S: string;
var I: integer;
begin
S:='On the '+Cardinals[Day]+' of Christmas ';
S:=S+'my true love gave to me'+CRLF;
for I:=Day downto 0 do
begin
if (Day>0) and (I=0) then S:=S+'and ';
S:=S+GiftList[I]+CRLF;
end;
Memo.Lines.Add(S);
end;
 
procedure TwelveDaysOfChristmas(Memo: TMemo);
var I: integer;
begin
for I:=0 to 12-1 do DoOneDay(Memo,I);
end;
 
 
</syntaxhighlight>
{{out}}
<pre>
On the first of Christmas my true love gave to me
a partridge in a pear tree.
 
On the second of Christmas my true love gave to me
Two turtle doves
and a partridge in a pear tree.
 
On the third of Christmas my true love gave to me
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the forth of Christmas my true love gave to me
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the fifth of Christmas my true love gave to me
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the sixth of Christmas my true love gave to me
Six geese a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the seventh of Christmas my true love gave to me
Seven swans a-swimming
Six geese a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the eight of Christmas my true love gave to me
Eight maids a-milking
Seven swans a-swimming
Six geese a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the ninth of Christmas my true love gave to me
Nine ladies dancing
Eight maids a-milking
Seven swans a-swimming
Six geese a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the tenth of Christmas my true love gave to me
Ten lords a-leaping
Nine ladies dancing
Eight maids a-milking
Seven swans a-swimming
Six geese a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the eleventh of Christmas my true love gave to me
Eleven pipers piping
Ten lords a-leaping
Nine ladies dancing
Eight maids a-milking
Seven swans a-swimming
Six geese a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
 
On the twelfth of Christmas my true love gave to me
Twelve drummers drumming
Eleven pipers piping
Ten lords a-leaping
Nine ladies dancing
Eight maids a-milking
Seven swans a-swimming
Six geese a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
and a partridge in a pear tree.
Elapsed Time: 34.088 ms.
</pre>
 
 
=={{header|Dyalect}}==
465

edits