+ 1
perform operations from strings expersions
How can i perform operation from a string such like "2+5*4" and display answer as 22. input: "20+2*2" output 24
3 Answers
+ 1
Sacalivin Obiri , in JS you can use eval() function.
+ 1
In C, as far as I know, there's no function to do that. You have to write your own.
edit: check this https://stackoverflow.com/questions/1151127/evaluating-mathematical-expressions