Posts

Showing posts from November, 2018

More on Variables in C++ using Visual Studio 2017 Community Edition

Image
Image
·          We define a variable by stating its type, followed by one or more spaces, followed by the variable name and a semicolon. E.g.: bool IsOK ·          The variable name can be virtually any combination of letters, but it cannot contain spaces. ·          Legal variable names include j, i245abcd, and mySalary. ·          Good variable names tell us what the variables are for; using good names makes it easier to understand the flow of the program. The following statement defines an integer variable called int mySalary: ·          Many programmers prefer to use all lowercase letters for their variable names. If the name requires two words (for example, my car), two popular conventions are used: MyCar, myCar. The latter form is called camel notation because the capitalization looks something like a camel’s hump with the former known as Pascal case. ·          Keywords Some words are reserved by C++, and so they cannot be used as variable names. These key