I found this snippet of code which sets out deliberately to confuse. Can you find out what the code does ? Eventually I'll post where I found this from and give credit where it is due.
The code is in C. The key is in char a[ ] = "ABCD"; /* string representation */ char b[ ] = "\x41\x42\x43\x44"; /* hexadecimal representation */ char c[ ] = "\101\102\103\104"; /* octal representation */ char d[ ] = "A" "B" "C" "D"; /* using string properties */ char e[ ] = {'A', 'B', 'C', 'D', ' \0'}; /* using char propery */ In C all the above strings a, b, c, d and e represent �ABCD�. Please post the output also. I'll post the answer soon. I thought I'd just give someone the pleasure of finding the answer.
Here is the code again, resembling code this time in case people were trying to read it South Pole top-wise, following Bert's advice about globes. Run the program as <program name> int1 int2 where int1 and int2 are integers between -180 and 180. Ok, Ok , the integers are latitude,longitude and the program gives their location in a way. Try 38 and -122 for San Francisco. regards [ September 01, 2003: Message edited by: HS Thomas ]
HS Thomas
Ranch Hand
Joined: May 15, 2002
Posts: 3404
posted
0
The solution is in danger of going unposted. Well, I've tried and don't get any output and can't explain how it works. There's no fun in posting a solution when no one has tried. regards
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
I don't know how it works, but the output is a (flat) map of the world. It is quite clever - I just wish I was clever enough to understand how it worked.
HS Thomas
Ranch Hand
Joined: May 15, 2002
Posts: 3404
posted
0
At least you got it to run. Quite an OBE (Out of Body Experience). I better post the link to the solution then. Enjoy!
Obfuscated Code Notice how the graemlins lie in an orbit like planets round the world. Another OBE! regards [ September 02, 2003: Message edited by: HS Thomas ]
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
It runs OK on Windows XP, but crashes on Win98. This is a real memory jog/guess - 16 bit unicode Vs 8 bit unicode?
HS Thomas
Ranch Hand
Joined: May 15, 2002
Posts: 3404
posted
0
Well ,I'm trying to run it on XP. Unless the output is being directed elsewhere, I'm not seeing any. regards
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
I use the Dev-C++ compiler, so I had to add getchar(); at the end, otherwise it just ran/closed. [ September 03, 2003: Message edited by: Michael Dunn ]
HS Thomas
Ranch Hand
Joined: May 15, 2002
Posts: 3404
posted
0
Thanks Michael, I'll give that a shot when I have some time. regards
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.