Saturday, 24 August 2013

How to generate a random operator, put it in string, and evaluate the string

How to generate a random operator, put it in string, and evaluate the string

I'm trying to build an equation that takes random operators.
3 x 5 x 8 x 2
where x represents either a +, -, / * operator.
2nd question: if the equation is a string, can golang evaluate the answer?
(this question is for this problem
http://www.reddit.com/r/dailyprogrammer/comments/1k7s7p/081313_challenge_135_easy_arithmetic_equations/
)

No comments:

Post a Comment