|
|
|
|
|
|
|
Figure 1-6
Compilation/Execution |
|
|
|
|
|
|
|
|
It is important to understand that compilation and execution are two distinct processes. During compilation, the computer runs the compiler program. During execution, the object program is loaded into the computer's memory unit, replacing the compiler program. The computer then runs the object program, doing whatever the program instructs it to do (see Figure 1-6). |
|
|
|
|
|
|
|
|
The instructions in a programming language reflect the operations a computer can perform: |
|
|
|
|
|
|
|
|
A computer can transfer data from one place to another. |
|
|
|
|
|
|
|
|
A computer can input data from an input device (a keyboard, for example) and output data to an output device (a screen, for example). |
|
|
|
|
|
|
|
|
A computer can store data into and retrieve data from its memory and secondary storage (parts of a computer that we discuss in the next section). |
|
|
|
|
|
|
|
|
A computer can compare two data values for equality or inequality. |
|
|
|
|
|
|
|
|
A computer can perform arithmetic operations (addition and subtraction, for example) very quickly. |
|
|
|
|
|
|
|
|
Programming languages require that we use certain structures to express algorithms as programs. There are four basic ways of structuring statements |
|
|
|
|
|