I am making a program for expression evaluation. I was trying to define these implement the precedence function more easily. Can I do this in a separate class???
Open any code you wrote before and which is working.
Search for "find and replace" functionality in your IDE. It "what to replace" field write "+"; in "replace with what" field write "10". Press Replace. That what define does.
You will need to implement precedence some other way.
Once I used vector of strings where higher precedence operators were stored first and same precedence were stored in same string.