| |
|
|
|
|
|
|
| Programmers' Lounge It's ok if the world out there don't understand your languages. Here the place for the great programmers around the world to start talking - in their very own unique languages. |

06-24-2006, 07:17 PM
|
|
Member
Friendizen
|
|
Join Date: Jun 2006
Posts: 82
|
|
|
"C" Program won the first prize in IOCCC Contest.
This C program won the first prize in International obfuscated C code contest (IOCCC) held recently. can u guess the output of this prog?
Small 5 Lines "C" Programme
#include
main(int t,char _,char *a)
{
return!0
}
..
..
Output of the same "c" Programme
On the first day of Christmas my true love gave to me
a partridge in a pear tree.
On the second day of Christmas my true love gave to me
two turtle doves
and a partridge in a pear tree.
On the third day of Christmas my true love gave to me
three french hens, two turtle doves
and a partridge in a pear tree.
On the fourth day 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 day of Christmas my true 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 true 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 true 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 true 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 true 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 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 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 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 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 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 gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
Press any key to continue
It uses recursion with pointers. see if u cud trace the flow.
|

06-30-2006, 10:06 AM
|
|
Senior Member
Professor
|
|
Join Date: Apr 2006
Location: Patna, Bihar
Posts: 1,682
|
|
|
Re: "C" Program won the first prize in IOCCC Contest.
Is it only five lines programmmmmmmmmm.
Amazingly done.
No wonder that it won the first prize.......
|

07-18-2006, 07:07 AM
|
|
Senior Member
Professor
|
|
Join Date: Apr 2006
Location: Patna, Bihar
Posts: 1,682
|
|
|
Re: "C" Program won the first prize in IOCCC Contest.
char *Number[12]={"One","Two","Three", "Four", "Five", "Six", "Seven","Eight",
"Nine", "Ten", "Eleven", "Twelve"},*Some[12]={"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"},*Days[12]=
{"First","Second","Third","Fourth","Fifth","Sixth" ,"Seventh","Eight",
"Ninth","Tenth","Eleventh","Twelth"};
void Fun1(int i, int j)
{
if(i==12) return;
if(j==i) printf("On the %s day of Christmas
my true love gave to me ",Days[i]);
printf("%s %s,",Number[j],Some[11-j]);
if(j>0) Fun1(i,j-1)else{
printf("\b \n");
Fun1(i+1,i+1);}
}
void main()
{
clrscr();
Fun1(0,0);
getch();
}
|

02-28-2007, 01:29 PM
|
|
Member
Friendizen
|
|
Join Date: Mar 2006
Posts: 61
|
|
|
woaaaa
i'm going dizzy tring to know what you guys are talking about,
|

03-06-2007, 10:56 AM
|
 |
Member
Friendizen
|
|
Join Date: Feb 2007
Posts: 67
|
|
|
c
Can anyone explain the working of this C program?
What type of arguments we need to pass in it?
OR we don't need to pass any argument.
I am unable to understand Command line arguments used in this program. Help me.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +1. The time now is 03:18 PM.
|
|
|