Chapter 6

Dividing Your Work with Functions

IN THIS CHAPTER

check Working with functions

check Writing your own great functions

check Fun with strings

check Manipulating main()

People generally agree that most projects throughout life are easier when you divide them into smaller, more manageable tasks. That’s also the case with computer programming — if you break your code into smaller pieces, it becomes more manageable.

C++ provides many ways to divide code into smaller portions. One way is through the use of what are called functions. A function is a set of lines of code that performs a particular job. In this chapter, you discover what functions are and how you can use them to make your programming job easier.

Remember You don’t have to type the source code for this chapter manually. In fact, using the downloadable source is a lot easier. You can find the source for this chapter in the \CPP_AIO4\BookI\Chapter06 folder of the downloadable source. See the Introduction for details on how to find these source files. ...

Get C++ All-in-One For Dummies, 4th 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.