how to do an arithmetic factorization and calculation

Joined
Dec 22, 2009
Messages
7
Reaction score
0
Hi,

can anyone help me find an algorithm that recieves a string and calculate it's arithmetic value?

for example:

the method will recieve: "(4+(6*2))/(2+2)"
and the result would be 4.

No need to do a validation on the string, we assume it's correct.

Thanks!
 
Joined
Dec 22, 2009
Messages
7
Reaction score
0
I found the Reverse Polish Notation, that answerd my question.
If anyone runs into the same issue, they can use the following links:
en.wikipedia.org/wiki/Reverse_Polish_notation
and :
en.wikipedia.org/wiki/Shunting-yard_algorithm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top