The most fundamental building block in the programming toolkit is the function—often known as procedure or subroutine in other languages. A function is a group of related statements that accomplish a specific task. Once you define a function, you can execute it whenever you need to do so.
Understanding functions is a crucial step to programming in C++: Without functions, it would be a practical impossibility to engage in serious programming projects. Imagine how difficult it would be to write a word processor, for example, without some means of dividing the labor. Functions make this possible.
If you’ve followed the book up until this point, you’ve already seen use of a function—the sqrt