O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required