|
|
|
|
|
|
|
The Elements of C++ Programs |
|
|
|
|
|
|
|
|
Programmers develop solutions to problems using a programming language. In this chapter, we start looking at the rules and symbols that make up the C++ programming language. We also review the steps required to create a program and make it work on a computer. |
|
|
|
|
|
|
|
|
In Chapter 1, we talked about the four basic structures for expressing actions in a programming language: sequence, selection, loop, and subprogram. We said that subprograms allow us to write parts of our program separately and then assemble them into final form. In C++, all subprograms are referred to as functions, and a C++ program is a collection of one or more functions. |
|
|
|
|
|
|
|
|
Each function performs some particular task, and collectively they all cooperate to solve the entire problem. |
|
|
|
 |
|
 |
|
|
Function A subprogram in C++. |
|
|
|
|
|