I'll try to give as much info as I can.
So the input is a mathematical expression (e.g. 1+2, 1++2-3, 1-(2+[2+3)-2] ...)
I must determine whether it is written by arithmetical rules or not.
I though it would be a good idea to save the expression into an array and then start checking all elements in an array to see if the expression is good.
The problem is I don't know how to see if one element comes before another, for example here --> 1+7/3(2+7) - this is not correct because there is no '*' before the '('. How do I check that?
Or here --> 9+6/5*(1+[2+3)] - how can I know at which position the elements are?
It would be awesome if you could help me :)
Aucun commentaire:
Enregistrer un commentaire