PDA

View Full Version : What is your favorite piece of code?



Yoshi
01-21-2002, 06:28 PM
Mine is:



#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<iostream.h>

void hell(char* sacrifice)
{
char frag;
cout << "You are in hell";
if (sacrifice == "N" || sacrifice == "n")
cout <<"There is no way you can get out";
do{
if (kbhit())
{
frag = getch();
if (frag == 3) // Ctrl + C detection
cout << "How dare you use the ^C function!!";
if (sacrifice == "N" || sacrifice == "n")
for(; 1!=1;);
if (sacrifice != "N" || sacrifice != "n")
cout << "Thank you!!";
}
}while(sacrifice == "N" && sacrifice == "Y");
system("PAUSE");
}

main()
{
char* sacrifice;
cout << "Want to sacrifice something important?(Y / N) ";
cin >> sacrifice;
if (sacrifice == "N" || sacrifice == "n")
{
hell(sacrifice);
}
else if (sacrifice == "Y" || sacrifice == "y")
{
cout << "What do you want to sacrifice? ";
cin >> sacrifice;
hell(sacrifice);
}
else
{
sacrifice = "N";
hell(sacrifice);
}
return 0;
}

Mind you.
:p

nvoigt
01-22-2002, 12:16 AM
while( ! asleep() ) sheep++;

Deckard
01-22-2002, 07:03 AM
My favorite piece of code is any that lacks compile-time, link-time, or run-time errors :)

mithrandir
01-22-2002, 07:12 AM
Originally posted by nvoigt
while( ! asleep() ) sheep++;

LOL

My favourite piece of code is the one that works :)