Dividing Your Work with Functions
In This Chapter
Calling a function
Passing things, such as variables
Writing your own great functions
Fun with strings
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, we show you what functions are and how you can use them to make your programming job easier.
Dividing Your Work
If you have a big job to do that doesn’t involve a computer, you can divide your work in many ways. Over the years of studying process management, people have pretty much narrowed the division of a job to two ways: using nouns and using verbs.