Hey everyone, so I have a assignment due that is asking me to complete a fully working calculator that runs in the command console. The assignment only requires the calculator to have certain functionality that the professor assigned to me (Everyone in the class needed the basic +, -, *, / but he also gave every person other things they have to implement into it also).
I believe that I have completed everything that he asked me to do for my assignment so that is not my problem. What brings me here today is that we have the option to add anything we want to the calculator and can be awarded extra credit for it depending on what it is.
So I was thinking about added a special function to it that lets the user define their own expressions that they use regularly and then stores that expression so they can access it later. For example, lets say a user calculates something everyday at work and they use the expression n * 10 / 2 to do it. So they want to add that expression into the calculator so that they only need to enter the number for n then it automatically does the calculation. So basically the programmer(me) doesn't know what expression the user will enter.
Is it possible to store a expression like that without me knowing what the expression will be? This assignment won't be due for awhile so I don't mind do some work (I actually would love it). The only advice someone has gave me so far was to build a parser for it? Which I am not sure how to do. Let me know if I'm not making any sense, since I am having a hard time trying to explain this.