07-09-2014 05:19 PM
Hi all,
I want to write a code that reads two numbers from two different text files (via a file open dialogue box), and perform addition on these two numbers - this operation should happen.
Then after that, I want a dialogue box to pop up and ask whether to perform another operation (say subtraction). If the answer is NO, the code should stop and write the result from the addition into a file.
If the answer is yes, then the code should subtract the two numbers, and write both the sum and the difference of the two numbers into a file.
Question: is this an example where a state machine is used? What would a simple prototype code look like? If I can get this, then I can apply the example to my much more complicated (not fundamentally more difficult) problem at hand.
07-09-2014 06:19 PM
This seems more than reasonable to use a state machine.
I recommend looking through the project examples. There should be a basic state machine in there. You should also give this paper a good read: Application Design Patterns: State Machines
07-09-2014 08:26 PM
Thanks. I'll give that paper a try, and if I can't figure it out, I'll post.