Thread: 0123456789

  1. #16
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    It will count from 0-9, 10-1, and repeat?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  2. #17
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by major_blagger
    Code:
    main(){int i;for(*&i=0;(&i)[0]<012;0[&i]++)putchar(060^i|060|i^060);putchar(10);}
    What was the point of taking Salem's code and stripping out all the newlines? And on an aside, the newline doesn't have to be decimal 10, IIRC.

    Quzah
    Hope is the first step on the road to disappointment.

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > and fluffing up the print with a no-op is rather like cheating
    It took a long time to make that a palindrome





    PS Jez
    The tags use / not \
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #19
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    It will count from 0-9, 10-1, and repeat?
    CORRECT !!! Xsquared you win a prize. The prize is the satisfaction of getting it right (o.k. I'm a cheapskate). You didn't cheat by running it did you?

    PS Jez
    The tags use / not \
    Sorry I had my fingers screwed on backwards.

  5. #20
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Originally posted by Prelude
    >for(*&i=0;(&i)[0]<012;0[&i]++)putchar(060^i|060|i^060);
    The loop control is a little cliche for obfuscated code, and fluffing up the print with a no-op is rather like cheating, don't you think?

    What do you mean by 'obfuscated'? I always code like that.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  6. #21
    Registered User
    Join Date
    Feb 2004
    Posts
    72
    Originally posted by quzah
    What was the point of taking Salem's code and stripping out all the newlines? And on an aside, the newline doesn't have to be decimal 10, IIRC.

    Quzah
    For fun. Something tells me people aren't referring to this thread to get style tips.

  7. #22
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >You didn't cheat by running it did you?
    Pfft. That takes all of the fun out of it.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  8. #23
    Registered User joed's Avatar
    Join Date
    Mar 2004
    Posts
    59

    0123456789

    Code:
    main(){int n=057;while(n++-071)putchar(n);}
    a little convoluted, but not too bad...

  9. #24
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >It took a long time to make that a palindrome
    Well, I suppose if that's what you were going for then I'll let you off the hook. But I'd be more impressed if you made the entire program a palindrome.
    My best code is written with the delete key.

  10. #25
    Registered User
    Join Date
    Mar 2003
    Posts
    143
    I couldn't resist throwing in a bit of recursion...
    Code:
    #include <stdio.h>
    int main(int a,char *b[])
    {
      putchar((a^sizeof(**b))?(a^0xb)?(main(a+sizeof(**b),b),0x3b-a):0x3b-a: 
        (main(1<<1,b),((a<<a)|(a<<((a<<a)|a)))));
      return 0;
    }
    DavT
    -----------------------------------------------

  11. #26
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    I though calling main from main was not a good thing? I am sure it is just to show obfuscation.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting MINI-BASIC in MASM over to C++?
    By Paul Panks in forum Projects and Job Recruitment
    Replies: 405
    Last Post: 07-04-2009, 05:41 PM