Thread: Can someone explain the logic of the program

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    32

    Can someone explain the logic of the program

    Code:
    main()
    {
    int a,b,c;
    int count = 1;
    for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\
    TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
    UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
    NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
    HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
    T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
    Hq!WFs XDt!" [b+++21]; )
    for(; a-- > 64 ; )
    putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
    return 0;
    }
    Explain the logic please.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Where and how did you get this program in the first place?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    32
    ^ A friend of mine has given this program and asked me for output of it without compiling on compiler. I tried but couldnt sunderstand it properly.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by chibi.coder
    A friend of mine has given this program and asked me for output of it without compiling on compiler. I tried but couldnt sunderstand it properly.
    Why don't you ask your friend to explain it to you? Why don't you compile and run it, perhaps using a debugger?

    After all, if you are asking us, that means that you failed the challenge, so if you are really interested in unravelling this obfuscated program, then go all out. No need to keep to the "without compiling on compiler" rule, and certainly I expect you to format and rewrite the program to make it easier to understand.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    Looks like something out of The International Obfuscated C Code Contest

    It's basically like a crossword puzzle - all the fun is in figuring it out.

    A completed puzzle is just "meh, so what".
    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.

  6. #6
    Registered User
    Join Date
    Nov 2011
    Posts
    32
    My impatience made me to post this thread :/. Sorry to bother you guys.
    I'll definitely gonna reveal it. I may learn new things while revealing it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please help me with the 'Logic' of this program
    By andy8 in forum C++ Programming
    Replies: 6
    Last Post: 08-23-2011, 10:23 AM
  2. logic of the program.
    By vijayshankar in forum C Programming
    Replies: 5
    Last Post: 02-08-2011, 05:30 AM
  3. Replies: 2
    Last Post: 10-14-2009, 07:45 AM
  4. program logic
    By kermit in forum C Programming
    Replies: 12
    Last Post: 08-16-2003, 02:42 PM
  5. Need help with the logic of the program
    By unregistered in forum C++ Programming
    Replies: 6
    Last Post: 01-16-2002, 07:39 PM