This video covers context-sensitive editors,
keywords, valid names and special characters
Most of the editors for use with programming languages
are context-sensitive editors
meaning they automatically do the
indentation for you and change the color
of the text based on the programming language.
Here's an example for C or C++ 
where blue indicates a keyword. 
That's a word thats reserved by the language.
Green as a comment.  Red as a literal value.
And black has no special meaning to the compiler.
For example the keywords    if   and   else
are part of the C and  C++ languages
These words are used
as part of the    if statement.   They have
special meaning and cannot be used as
identifiers or
variable names in your programs.
The next line gives examples of
keywords for the C language and then
the next slide after that, gives samples
of keywords that are added with
the C++ language.
Don't worry about memorizing 
all these keywords.
Since you have a context-sensitive
editor,
if it shows up in blue, then you know
it's a reserved word or a keyword.
The next thing I want cover
is valid names.
You can choose how to name 
your objects and your
functions and your variables and your constants. 
There are only a few rules you have to follow.
First thing is, you cannot have 
any spaces in your name.
You can use the underscore 
so that it's sort of like a space.
But as far as a computer is
concerned it's still one solid name.
You can also capitalize the
first letter in each 
English word and still
put them all together. So that it starts
off with a capital letter
in each word but still it's 
all together in one piece.
Here's a chart with sample valid variable names
The Good, the Bad and the Ugly
[ view the orange and yellow chart ]
Here's another thing to consider
is that the uppercase letters and lower case
letters are considered
as totally separate letters in
C and C++
It's kind of like we have 
52 letters in the alphabet.
26 capital letters and
26 lower case letters.
In these languages, they make a
difference between
a big-A and a little-a. So it's like they are
two completely separate characters.
You kind of have to remember that.
When you define variable
if you use a capital-letter, it has to be
capital-letter when you use it later.
Since you can't do that, some people think,
“Wow you know
I can use capital letters for one variable
and I can use the same name but 
I use a small letter to start it.”
Well that gets kind of gets confusing so
try to avoid that. Like      
Temp   with a capital-T
and then   temp   that starts with a lower case-t
Well, it confuses people.
As far as the computer's concerned
they're totally different.
When building a program
a lot times a compiler will create
its own internal names.
0:03:36.430,0:0:03:41.879
Usually they'll start with an underscore
just to keep them separate from the ones
that you are creating.
So avoid starting a name with the
underscore
because the compiler might try 
to use the same name also.
The C and C++ languages
use almost every character 
that's on the keyboard.
I think what happened is when the 
developers of the original C language 
were working with the Teletype 
printing terminal, they said,
“I wonder what we can use 
this character for?”
So a lot of languages spell out AND
when they're trying to do a logical AND
C and C++ use the double ampersand.
Instead using OR
and typing OR  like a lot of
other languages,
C and C++ use the vertical bar.
Here's three slides of special characters 
and their uses.
Parentheses:  We're going to use those for
math expressions and function arguments.
Curly braces identify
blocks of code or data.
The square brackets 
are used to identify arrays.
Angle brackets are used to locate the
compilers directory for #include files 
>  for  cin
The double quotes indicate 
a project directory
or could indicate a string constant.
Single quotes
are for defining a single character.
The percent sign to
compute remainder for
an integer division.
Forward slash to compute 
the quotient for division
or do using floating point values
then is the full quotient including the
decimal places.
Backslashes a special character and 
that one is used for escape sequences
inside of character strings.
We will cover that in a minute. 
The exclamation mark. That is a NOT
The tilde (~) is a one's complement.
That flips every bit.
The asterisk is used for multiplication
and pointer declaration or de-reference.
The minus signs for subtraction.
The underscore
well we can use that like 
pretend it a space.
The period as a separator in numbers
for like 145.338
or use it as a separator for
structured data and classes.
The comma, combine more than one
statements together.
Semi-colon marks the end of a statement.
The colon together with question mark is the
selection operator and it's also 
used for labels and classes.
Then we have a bunch of
other ones.
The hash mark is a preprocessor
directive like    #include
The ampersand (&) is a logical AND
and a bitwise AND,
the Address-of operator and 
reference declaration.
Vertical bars for OR
The caret (^) as a
logical Exclusive-Or.
A question mark together with the colon
make the selection operator.
The at-sign @ and the dollar sign
I haven't seen those used. 
Probably around somewhere.
Consider are the escape sequences 
inside a character string or 
character definition.
Backslash-n ( \n ) means newline.
Backslash-r ( \r ) means return.
So a return brings you all the
way back to beginning of the line.
Backslash-n  (\n )  brings it down 
to the next line.
We also have things like backslash-a
stands for 'announce'
The old Teletypes that ring the bell.
On a regular terminal, it just goes BEEP
Backslash-t ( \t ) is a tab
moves to the next 8th position on the screen.
or on the printer.
So check those out.
If you want to define or display a
backslash,
then inside a character string you need
to do backslash-backslash ( \\ )
and that will create single
backslash inside the character string.
Now since character strings start off and
the end with a quote,
what do you do if you want a quote in
the middle of a character string?
Backlash-quote  ( \” )  or a single quote, 
backslash-single-quote ( \' )
Does that make sense?
Well I hope this helped
and makes more sense too.
Bye  Bye
