Things You Can Do to Enhance the Calculator

You have worked on the calculator throughout this book, transforming it again and again, either to add capabilities or to reorganize it and make it easier to understand.

Now you can carry on that work and add some capabilities yourself.

Add Undo/Redo Capabilities

You can undo the effects of calculations by setting the accumulator to zero and replaying the tape to the request before the last one on the tape. You can even keep two extra tapes—an undo tape that contains all the requests that haven't been undone, and a redo tape that contains requests that have been undone. Then an undo operator can swap the last entry from the undo tape to the redo tape, clear the accumulator, and replay the undo tape. ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.