How do I input an equation with all of the math operators included?

I want to make a calculator, but I don't want to use too many cases. Is there a way to input an equation with all of the operators included? For example, I would input an equation such as 5 + 2 - 1 and then have it print 6 or whatever the answer may be. Thanks in advance.

Re: How do I input an equation with all of the math operators included?

Quote:

Originally Posted by

**jerdaniel** I want to make a calculator, but I don't want to use too many cases. Is there a way to input an equation with all of the operators included? For example, I would input an equation such as 5 + 2 - 1 and then have it print 6 or whatever the answer may be. Thanks in advance.

Read my blog articles; one talks about a ScriptEngine (notably Javascript) that can do the job for you; another article talks about an expression compiler (and evaluator) that can also do the job for you.

kind regards,

Jos

Re: How do I input an equation with all of the math operators included?

I thank you for the suggestion, but when I try to get to your blog posts, it says I don't have permission to do that.

Re: How do I input an equation with all of the math operators included?

Quote:

Originally Posted by

**jerdaniel** I thank you for the suggestion, but when I try to get to your blog posts, it says I don't have permission to do that.

How strange; can you see the line "Blog entries" at the top right of my reply? (It says "7"); can you click that link? Otherwise there's a tab near the top of the page; it says "Blogs" and it should lead you to all the blog entries. Let me know what happens and I see if they can fix it or tell us why you can't do it (it should've something to do with the number of posts you've made ...)

kind regards,

Jos