07-10-2003, 10:48 AM
create a function (which is allowed to use many other functions aswell and subs) that evaluates an expression.
i.e:
print evaluate("2*((3*4)+52)") 'returns 128
print evaluate("-10") 'returns -10
print evaluate("-2^8") 'returns -256
print evaluate("-sin(10+31/5) + 8") 'returns something i cant be bothered calculating :p
try to make it work in all cases, and try to remain as simple as can be.
i.e:
print evaluate("2*((3*4)+52)") 'returns 128
print evaluate("-10") 'returns -10
print evaluate("-2^8") 'returns -256
print evaluate("-sin(10+31/5) + 8") 'returns something i cant be bothered calculating :p
try to make it work in all cases, and try to remain as simple as can be.