What is your favorite piece of code?

This is a discussion on What is your favorite piece of code? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Mine is: Code: #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<iostream.h> void hell(char* sacrifice) { char frag; cout << "You are in hell"; if ...

  1. #1
    A Banana Yoshi's Avatar
    Join Date
    Oct 2001
    Posts
    857

    What is your favorite piece of code?

    Mine is:

    Code:
    #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
    Last edited by Yoshi; 01-21-2002 at 05:59 PM.
    Yoshi

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    while( ! asleep() ) sheep++;
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    B26354 Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    My favorite piece of code is any that lacks compile-time, link-time, or run-time errors :)
    Jason Deckard

  4. #4
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    Originally posted by nvoigt
    while( ! asleep() ) sheep++;
    LOL

    My favourite piece of code is the one that works

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. whats wrong with this piece of code?
    By psycho88 in forum C Programming
    Replies: 3
    Last Post: 12-03-2005, 10:28 PM
  2. Help with a piece of code
    By Victor4015 in forum C++ Programming
    Replies: 1
    Last Post: 11-16-2005, 04:38 PM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 11:38 AM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 03:28 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21