|
Well, it contains exactly the same elements as any other computer program— data to store your information and blocks of code that manipulate that data. Whether your previous experience is with Microsoft Visual Basic or with 40- year-old COBOL, the basic elements will be familiar. Much mystery surrounds the practice of C++ programming, but most of it is unwarranted and unnecessary. Let’s start with some basic ground rules for C++.
If you have a variable that has been declared able to store apples, you can store only apples in it. However, this requirement is not as grim as it sounds. C++ contains many features for providing implicit conversions where necessary. This strong type checking eliminates many common programming bugs because it explicitly disallows any data type conversions that could result in data loss.
If you write code that needs to execute quickly (for example, code that sorts lists or performs complex mathematics), C++ should be your language of choice.
Modern programmers like the many advantages of object-oriented programming. (See Chapter 2 for more information on object-oriented programming.) C++ is one of the premier object-oriented programming languages.
C is a well-established language. Although C++ includes some strange features—to maintain its compatibility with C—it probably wouldn’t be as popular as it is without C compatibility.
If the compiler warns you about an undeclared variable, you probably typed an uppercase character instead of a lowercase character (or vice versa).
|