The homework is to create a pretty simple calculator, and I think I understand how to do all the calculations well enough, but I'm struggling with a different part of the homework. The user inputs some thing like this:
which means add 5 to the running total. Or something like this:
which means divide the running total by 3.
I don't understand how to go about having my program decide which calculation to perfom. I found the below code on nasm.us, which makes sense, but I don't know how it would translate to seperating user input.
%substr mychar 'xyzw' 2 ; equivalent to %define mychar 'y' %substr mychar 'xyzw' 3 ; equivalent to %define mychar 'z' %substr mychar 'xyzw' 2,2 ; equivalent to %define mychar 'yz' %substr mychar 'xyzw' 2,-1 ; equivalent to %define mychar 'yzw'
Even this is pretty far beyond what we've been taught in class, so I'm not even sure this is the kind of thing I'm looking for.
Since my program needs to run around the idea of this kind of user choice input, I haven't started on my program yet, so I have no code of my own to post. I feel I need to understand how to determine whether the user wants to add, multiply, subtract or divide before I can get to work.
Any little nudge in the right direction would be appreciated. Thanks in advance.