Uppercase and Lowercase

C++ is extremely picky about your Caps Lock key. Most of a C++ program appears in lowercase letters. 

Although Visual C++ cares little about whitespace, it does know the difference between uppercase and lowercase letters. Most of the time, Visual C++ prefers lowercase letters. Visual C++'s preference for lowercase letters sets it apart from most other programming languages. To many programming languages, the following statements are identical: 

if (netpay > grosspay)  If (NetPay > GrossPay)  IF (NETPAY > GROSSPAY)

To Visual C++, the three lines are extremely different. As you learn the C++ language, you will see when to use lowercase and when to use uppercase. Again, most of the time, you will program in lowercase letters. 

Visual C++ contains a fixed vocabulary of keyword commands (also referred to as reserved words). Appendix D contains a complete list of Visual C++ commands. A command is part of the limited vocabulary that Visual C++ recognizes. For example, the command that transmits a value from one place in the program to another is return. You must use lowercase letters for return, as well as for all the other commands in Visual C++. 

Refer to Appendix D, "Visual C++ Command Reference," often as you learn the commands of Visual C++, especially the specific commands beginning in Lesson 3, "Data Basics." 

If you want to print messages to the screen or to your printer, you can use uppercase, lowercase, or a mixture of both for the message itself. For example, recall that the program shown earlier printed this message to the screen: 

I will be a C++ expert!

Because this is a message for the user of the program to read, you would want Visual C++ to print it using regular uppercase and lowercase characters. Because the message is not a keyword, it does not have to be all lowercase. 

Before you go any further, a short review of the previous sections is warranted. Visual C++ is picky about lowercase commands and about making sure that you type special characters exactly right. Whitespace, however, is another thing entirely. Visual C++ does not care how much whitespace you add to a program for readability. 

For and for are two different words to C++. Be sure to maintain consistency with uppercase and lowercase letters. C++'s preference is usually lowercase letters. 

No comments: