Completing a Program

Keep it simple: as simple as possible, but no simpler.

– Albert Einstein

Writing a program involves gradually refining our ideas of what we want to do and how we want to express it. In Chapter 5, we produced the initial working version of a calculator program. Here, we’ll refine it. Completing the program – that is, making it fit for users and maintainers – involves improving the user interface, doing some serious work on error handling, adding a few useful features, and restructuring the code for ease of understanding and modification.

§6.1 Introduction

§6.2 Input and output

§6.3 Error handling

§6.4 Negative numbers

§6.5 Remainder: %

§6.6 Cleaning up the code

Symbolic constants. Use of functions. Code layout. Commenting ...

Get Programming: Principles and Practice Using C++, 3rd 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.