Book contents
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Computer Programming
- 3 Types, Operators, and Expressions
- 4 Control Flow
- 5 Type Conversion, Functions, and Scope
- 6 Pointers, Arrays, and Structures
- 7 File Operations
- 8 Case Studies
- Appendix A C Language Summary
- Appendix B Fortran Program Language Summary
- Appendix C ASCII Tables
- Appendix D C Preprocessor Directives
- Appendix E Precedence Tables
- Glossary
- Annotated Bibliography
- Index
2 - Computer Programming
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Computer Programming
- 3 Types, Operators, and Expressions
- 4 Control Flow
- 5 Type Conversion, Functions, and Scope
- 6 Pointers, Arrays, and Structures
- 7 File Operations
- 8 Case Studies
- Appendix A C Language Summary
- Appendix B Fortran Program Language Summary
- Appendix C ASCII Tables
- Appendix D C Preprocessor Directives
- Appendix E Precedence Tables
- Glossary
- Annotated Bibliography
- Index
Summary
Computer programming is the process by which we instruct a computer to perform a useful calculation or process. The computer can easily be described as an idiot savant, a term used by psychiatry to describe mental conditions in which individuals are capable of performing incredible feats of memory or calculation on request but are unable to understand the simplest activities of daily life. It is important to know that the computer will do only what it is instructed to do, no more and no less. Computers, sophisticated as they are, do not possess sentience or self-awareness. They cannot guess or anticipate what you want them to do; they simply do as instructed. There is a very old saying “garbage in, garbage out” that means if you put bad data into a program you can hardly expect to get good data out. Likewise, if your program is formed badly, the computer will not correct it for you.
Modern computers are rarely plagued by problems that cause them not to execute their instructions or to execute their instructions in a fashion other than that specified – in other words, they either work or they don't. If they seem to be acting strangely your program most likely is at fault. The most difficult task in the programming of a computer is the understanding of what the computer is supposed to do. To help make this task easier, we will examine techniques for describing problems and developing computer solutions.
- Type
- Chapter
- Information
- Publisher: Cambridge University PressPrint publication year: 1998