Click here to Skip to main content
15,886,639 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
suppose in a program i give input like "(a+b)/c+d-e/((f+g)/h" for example "(1+4)/8+9-7/((7+8)/h" the output I except as the answer to the input statement. How I will parse the input to find out integer and operator to make the arithmetic operation. in any language c,c+= or java

What I have tried:

no idea how to parse the input
Posted
Updated 3-Dec-16 10:30am

1 solution

See, for instance: Is there an eval() function in Java? - Stack Overflow[^] (unless you want to write your own parser).

Embedding Lua[^] in your C/C++ application is an interesting alternative.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900