i have a string
now how can i get the result????
I had this as a project in assembler class... it was fun
You'll want to parse the string into smaller parts as you find the operators. Then put each one into a string that you can then convert to an int or double. Then where you find your operator perform the operation. But you have to perform them based upon priority... so for your current string you would
parse it and find the operators
you'll have strings "40", "+", "40", "*", "4.2", "*", ".01", "+", "100"
you can have 2 temp vars(temp operator and temp double) and 2 stacks (operators and numbers) then as you pull them off the stack you check for priority of it versus the next operator then do the operation... store your cumulative answer and keep checking to see if there is more to do and do it
Have fun with the code :-)