Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Your best "Hello, world!" program in FreeBasic
#3
[syntax="qbasic"]#define gcfp(num) (val(mid(str(pi), num, 1)))
#define gwfp(num1, num2, num3) (chr(val(str(gcfp(piref(num1))) + str(gcfp(piref(num2))) + str(gcfp(piref(num3))))))

dim piref(7) as integer => {7, 13, 15, 4, 1, 8, 3, 0}
dim shared pi as double

pi = 1
add = 1

for i = 1 to 27
add = add + 2
pow = pow + 1
if sign then pi = pi + (add * 3 ^ pow) ^ -1 else pi = pi - (add * 3 ^ pow) ^ -1
sign = sign xor 1
next
pi = 2 * sqr(3) * pi


print gwfp(7, 2, 5) + gwfp(6, 7, 6) + gwfp(6, 7, 1) + gwfp(6, 7, 1) + gwfp(6, 6, 6) + gwfp(7, 3, 3);
print gwfp(7, 4, 5) + gwfp(6, 6, 0) + gwfp(6, 6, 6) + gwfp(6, 6, 3) + gwfp(6, 7, 1) + gwfp(6, 7, 7) + gwfp(7, 4, 4)

sleep[/syntax]

I'll give you a cookie if you can work out how it works ^^

Hint: it uses Pi :>
Reply


Messages In This Thread
Your best "Hello, world!" program in FreeBasic - by KiZ - 01-26-2006, 08:59 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)