Making the Calculator More General with a “Little Language”

You need to make a little change to the user interface of the calculator, to make it more “testable.”

User Interface

The part of the program that sends output to the user and gets input from the user.

Instead of prompting users to input numbers or indicate that they want to stop, the program will now get commands from a “little language.” These commands will be typed into the running program when it needs input—just as you type on your handheld calculator.

A statement in this language has the following form:

<operator><operand>

<operator> can be any of the following:

+ to add the operand ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.