how to do c programming and c++ ppt for beginners and c++ complete reference ppt
(Computer Science PPT)Reference Book
Sumita AroraCHAPTER 6
C ++ Programming language was
developed at AT & T Bells LAB early in
1980’s by BJARNE STROUSTRUP.
STROUSTRUP added some features to
his favorite language Simula 67.
STROUSTRUP called “ C with Classes
C++ ( C Plus Plus) is named by Rick
December 30, 1950 ) (age 60)
College of Engineering Chair in
Occupation Computer Science Professor, Texas
A&M University USA
Known for The creation of C++BJARNE STROUSTRUP
Bjarne Stroustrup giving a talk at Kent
State University on C++0x in 2007. C++ CHARACTER SET
Letters:- A-Z, a-z
Digits:- 0 to 9
Special Symbols:- space + - / ( ) =
= , „ “ ; : ? &
White Spaces:- Blank Space , Horizontal
Tab, Vertical tab, Carriage Return.
Other Characters:- C++ can process any
of the 256 ASCII Characters as data or as
The Smallest individual unit in a program
is known as Token.
Lexical Unit is the another name given to
C++ has following Tokens
1) Key words 2) Identifiers 3) Literals
4) Punctuators 5) OperatorsKEY WORDS
Key words are the words that convey
special meaning to the compiler.
Key words are also called as Reserved
words meaning their meaning is reserved
Some of Key words are,
float int auto extern double
case do while goto…etcIDENTIFIERS
Identifier is an arbitrary long sequence of
letters and digits.
The first character must be letter.
The underscore ( _ ) counts as letter.
Upper and Lower case letters are different.
All characters are significant.EXAMPLES OF IDENTIFIERS
C++ is a Case Sensitive Language as it
treats upper case letters and lower case
Some Valid identifiers,
Myfile DATE9_7_8 z3t9x3
MYFILE _DS _FXR
Some Invalid identifiers,
DATA-REC 28dre breakLITERALS
Literals often referred to as constants
These are the data items that never
change their value during the program run.TYPES OF C++ LITERALS
INTEGER – CONSTANT
CHARACTER – CONSTANT
FLOATING – CONSTANT
STRING – LITERALINTEGER CONSTANT
These are the whole numbers without any
An integer constant must have at least one
digit and must not contain fractional part.
It may contain + or - Sign.
A number with no sign is assumed as
Commas can not appear in integer
constant.TYPES OF INTEGER CONSTANTS
DECIMAL INTEGER CONSTANTS
OCTAL INTEGER CONSTANTS
HEXADECIMAL CONSTANTSDECIMAL INTEGER
An integer constant consisting of
sequence of digits is taken to be decimal
integer constant unless it begins with 0.
For instance 1234,56,+86,-56,-89,-22 are
decimal integer constant. OCTAL INTEGER CONSANT
A sequence of digits starting with 0(digit
Zero) is taken to be an octal integer
for instance Decimal 8 is written as 010
as octal integer
Decimal 12 is written as
12 = 14
10 8HEXADECIMAL INTEGER
A Sequence of Digits preceded by 0x or
0X is taken to be an hexadecimal integer
For instance decimal 12 is written as
12 = 0XC
The Suffix l or L and u or U is attached to
any constant indicates as long and
For Example:- 12L,189U …etcCHARACTER CONSTANT
A character constant is one character
enclosed within single quotes
Valid constants „a‟ „z‟ „k‟
Invalid Constants a z k
In c++ character constant must have
single character and must be enclosed in
single quotes.NONGRAPHIC CHARACTERS
Nongraphic character constants are those
characters that can not be typed directly
from the keyboard.
e.g backspace, tab, carriage return
C++ Allows programmers to have certain