Introduction to Programming in C++
"Begin at the beginning, and go on till you come to the end: then stop." This method of telling a story is as good today as it was when the King of Hearts prescribed it to the White Rabbit. In this book, we must begin with you, the reader, since my job is to explain a technical subject to you. It might appear that I'm at a severe disadvantage; after all, I've never met you.
Nevertheless, I can make some pretty good guesses about you. You almost certainly own a computer and know how to use its most common application, browsing the World Wide Web. If you use the computer in business, you probably also have an acquaintance with spreadsheets and word processors and perhaps some database experience as well. Now you have decided to learn how to program the computer yourself rather than relying completely on programs written by others. On the other hand, you might be a student using this book as a text in an introductory course on programming. In that case, you'll be happy to know that this book isn't written in the dry, overly academic style employed by many textbook writers. I hope that you will enjoy reading it as much as my previous readers have.
Whether you are using this book on your own or in school, there are many good reasons to learn how to program. You may have a problem that hasn't been solved by commercial software, you may want a better understanding of how commercial programs function so you can figure out how to get around their shortcomings and peculiarities, or perhaps you're just curious about how computers perform their seemingly magical feats. Whatever the initial reason, I hope you come to appreciate the great creative possibilities opened up by this most ubiquitous of modern inventions.1
Before we begin, however, we should agree on definitions for some fundamental words in the computing field. Susan had some incisive observations about the power of words. Here is our exchange on that issue:
Susan: I will read something usually at face value, but often there is much more to it; that is why I don't get it. Then, when I go back and really think about what those words mean, it will make more sense. This book almost needs to be written in ALL CAPS to get the novice to pay closer attention to each and every word.
Steve: IMAGINE WRITING A BOOK IN ALL CAPS! THAT WOULD BE VERY DIFFICULT TO READ, DON'T YOU THINK?
Many of the technical words used in this book are defined in the glossary at the end of the book. It is also very helpful to have a good dictionary of computer terms, as well as a good English dictionary.
Of course, you may not be able to remember all of these technical definitions the first time through. If you can't recall the exact meaning of one of these terms, just look up the word or phrase in the index or in the glossary.
Before we continue, let's check in again with Susan. The following is from her first letter to me about the contents of this book:
Susan: I like the one-on-one feel of your text, like you are talking just to me. Now, you did make a few references to how simple some things were which I didn't catch on to, so it kinda made me feel I was not too bright for not seeing how apparently simple those things were...
I think maybe it would have been helpful if you could have stated from the onset of this book just what direction you were taking, at least chapter by chapter. I would have liked to have seen a goal stated or a least a summary of objectives from the beginning. I often would have the feeling I was just suddenly thrown into something as I was reading along. Also (maybe you should call this C++ for Dummies, or is that taken already?)2, you might even define what programming is! What a concept! Because it did occur to me that since I have never seen it done, I really don't know what programming is! I just knew it was something that nerds do.
Susan's wish is my command, so I have provided a list of objectives at the beginning of each chapter after this one. I've also fulfilled her request for a definition of some programming terms.