TalkTopics.com - Talk about everything on earth!

Go Back   TalkTopics.com > TalkTopics Community > Computers & Technology > Programmers' Lounge

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.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-24-2006, 07:17 PM
naveenleo naveenleo is offline
Member
Friendizen
 
Join Date: Jun 2006
Posts: 82
naveenleo is on a distinguished road
"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.
Reply With Quote
  #2 (permalink)  
Old 06-30-2006, 10:06 AM
sanuanu sanuanu is offline
Senior Member
Professor
 
Join Date: Apr 2006
Location: Patna, Bihar
Posts: 1,682
sanuanu is on a distinguished road
Send a message via MSN to sanuanu Send a message via Yahoo to sanuanu
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.......
Reply With Quote
  #3 (permalink)  
Old 07-18-2006, 07:07 AM
sanuanu sanuanu is offline
Senior Member
Professor
 
Join Date: Apr 2006
Location: Patna, Bihar
Posts: 1,682
sanuanu is on a distinguished road
Send a message via MSN to sanuanu Send a message via Yahoo to sanuanu
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();
}
Reply With Quote
  #4 (permalink)  
Old 02-28-2007, 01:29 PM
kimmiz kimmiz is offline
Member
Friendizen
 
Join Date: Mar 2006
Posts: 61
kimmiz is on a distinguished road
woaaaa

i'm going dizzy tring to know what you guys are talking about,
Reply With Quote
  #5 (permalink)  
Old 03-06-2007, 10:56 AM
samkhan's Avatar
samkhan samkhan is offline
Member
Friendizen
 
Join Date: Feb 2007
Posts: 67
samkhan is on a distinguished road
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.
Reply With Quote
Reply



Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft creates 12 "good business" rules for windows arpan911 Business Lounge 3 03-04-2007 05:14 AM
Infinite light side points for "kotor" II cloud9925 General Topics 2 02-28-2007 01:35 PM
Excerpts from "alien intelligence" by stuart holroyd. hassen1 General Discussions 1 02-28-2007 01:32 PM
Why "smallville's" clark kent is way cooler than "superman" arpan911 General Discussions 1 02-28-2007 01:31 PM
Pinoys: Orig Singer of "I Will Be Here" Live in Manila 2006 jomarhilario Pop 1 02-28-2007 01:30 PM


All times are GMT +1. The time now is 03:48 PM.





Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6