Thread: Help needed with Puzzle solution provided in C

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    Help needed with Puzzle solution provided in C

    Hello
    I'm trying to solve a puzzle which should give me some coordinates - latitude, longitude somewhere in Berlin, Germany.
    I'm assuming that the solution is written in C. Unfortunately my programming skills never made it past BASIC and Pascal some 20 years ago.

    It would be much appreciated if someone could tell me the results to the following two lines of code:

    (88%7?416<<14|252<<8&250<<8|508:399<<9|217<<10&374 >>5|1258)/(4<<15)

    (52<13?464<<11&116<<6|347<<8|1449:424<<13&452<<14| 577<<9|1229)/(8<<15)

    Thank you in advance

    Martin

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    Im not familiar with the "?" or ":" operators. Besides that, all the remaining operators can be found on a good scientific/programming calculator. On Linux you can use the default calculator and set it to "Programming" mode. I dont think the Windows calculator has this mode but you can check. If not, try and find an online programming calculator with these bitwise operators (AND, OR, shifting, modulo) or download one.

    After you have access to one of these good calculators, just plug in your numbers as its all mechanical. It would be very tedious to do it any other way--or just put those lines of code in a basic C program and printf its result.

    EDIT: Come to think of it, the "?" and ":" arent bitwise operators, but is actually a form of conditional operators. Something of the form
    Code:
    x > y ? 0 : 1
    means that if the condition before the "?" is true (or non-zero in your case) then the part directly after the "?" is executed, otherwise the part after the ":" is executed. So if x is greater than y, the result is "0", otherwise it is "1" (whatever this result may actually be).

    So using this condition operator in your first line means basically:
    Code:
    if (88%7 != 0)
    then do
      416<<14|252<<8&250<<8|508/(4<<15)
    otherwise do
      399<<9|217<<10&374 >>5|1258/(4<<15)
    Similar for your next line. So either check these two conditions on the two lines to determine what the numerator is (manually, or write a program (C, C++, Java, etc), or use a good calculator). Then divide it by the denominator, which isnt part of the condition and is the same for either case.
    Last edited by nadroj; 11-22-2009 at 07:47 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ help needed
    By Enkindu in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 08-31-2004, 11:24 PM
  2. When the memory needed for an array increases...
    By Xzyx987X in forum C Programming
    Replies: 3
    Last Post: 04-03-2004, 02:19 AM
  3. Replies: 2
    Last Post: 03-21-2004, 08:21 PM
  4. Help needed!
    By Lost__Soul in forum C Programming
    Replies: 21
    Last Post: 03-20-2003, 08:58 AM
  5. binary tree solution-- help needed
    By sanju in forum C Programming
    Replies: 3
    Last Post: 10-11-2002, 01:56 AM