quarta-feira, 24 de dezembro de 2008

C++ Poema de Natal



Para comemorar esse dia especial que é o Natal, mostro aqui um código interessante em C/C++ chamado xmas2005.c. Esse programa quando compilado mostra na tela um poema de natal (em inglês).

Faça o download do arquivo diretamente em: http://www.inf.bme.hu/~pts/xmas2005.c

Vale a pena compilar e conferir muito interessante!
Código fonte:


(clique na imagem para ampliar)


Para compilar o arquivo, utilizei o g++ no linux:

g++ xmas2005.c -o xmas2005



O resultado da execução do programa pode ser observado abaixo. É um poema de natal, há rumores que esse programa existe desde 1988.

Um ótimo Natal à todos!
Happy Christmas! Enjoy ;)

Vejam o resultado:

On the first day of Christmas my only love gave to me
a partridge in a pear tree.

On the second day of Christmas my only love gave to me
two turtle doves
and a partridge in a pear tree.

On the third day of Christmas my only love gave to me
three french hens, two turtle doves
and a partridge in a pear tree.

On the fourth day of Christmas my only love gave to me
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the fifth day of Christmas my only love gave to me
five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the sixth day of Christmas my only love gave to me
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the seventh day of Christmas my only love gave to me
seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the eighth day of Christmas my only love gave to me
eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the ninth day of Christmas my only love gave to me
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the tenth day of Christmas my only love gave to me
ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the eleventh day of Christmas my only 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 gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the twelfth day of Christmas my only 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 gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

Nenhum comentário: