EXPLORATION 20

image

Writing Functions

At last, it’s time to embark on the journey toward writing your own functions. In this Exploration, you’ll begin by improving the word-counting program you’ve been crafting over the past five Explorations, writing functions to implement separate aspects of the program’s functionality.

Functions

You’ve been using functions since the very first program you wrote. In fact, you’ve been writing functions too. You see, main() is a function, and you should view it the same as you would any other function (well, sort of, main() actually has some key differences from ordinary functions, but they needn’t concern you yet). ...

Get Exploring C++ 11, 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.