Professional Documents
Culture Documents
Unit – I
Overview of C++
C++ BASICS
C++ Character Sets
Tokens
1. Keywords
2. Identifiers
3. Literals
i. Integer constant
ii. Floating constant
iii. Character constant
iv. String literal
4. Punctuators
5. Operators
2
C++ Data types
1. Fundamental data types
a) int Data type
b) char Data type
c) float Data type
d) double Data type
e) void Data type
2. Derived data types
a) Arrays
b) Function
c) Pointer
d) Reference
e) Constant
3. User-Defined Derived data types
a) Class
b) Structure
c) Union
4. Data Type Modifiers
1. Signed
2. Unsigned
3. Long
4. Short 3
Operators and Expression
1. I/O Operators
2. Arithmetic Operators
3. Increment / Decrement Operators
4. Relational Operators
5. Logical Operators
6. Conditional Operators
7. Some other Operators
1. Sizeof()
2. Comma Operator
4
Flow of Control
1. Compound Statement
2. Selection statements
1. The if statement
2. The switch statement
3. Iteration Statements
1. The for loop
2. The while loop
3. The do..while loop
4. Nested Loops
4. Jump Statements
1. The goto statement
2. The break statement
3. The continue statement
5
Console I/O Operations
6
When? Where? Who?
7
C++ CHARACTER SET
8
The C++ has the following
CHARACTER SET
1. - A-Z, a-
LETTERS
2. DIGITS z
- 0-9
3. SPECIAL SYMBOLS
4. WHITE SPACES
5. OTHER CHARACTERS
9
TOKEN
S
C++ provides following tokens (smallest
individual unit in a program )
KEYWORDS
IDENTIFIERS
LITERALS
PUNCTUATORS
OPERATORS
10
KEYWORDS
11
Some of the KEYWORDs are…
12
IDENTIFIERS
13
Some of the valid
IDENTIFIERS are…
MYFILE
Myfile
Stud1
stud23
Emp_no
14
Some of the invalid
IDENTIFIERS
are…
MY.FILE
29Myfile
break
Emp-no
Reg No
15
LITERALS
16
Different types of
LITERALS are…
1. Integer-constant
2. Character-constant
3. Floating-constant
4. String-constant
17
INTEGER CONSTANT
19
FLOATING CONSTANT
20
STRING CONSTANT
[] () {} , ; : * = #
22
Basic Datatypes.
Operators.
Control Structures.
1. Fundamental (atomic or
dynamic or primitive) Datatype
1. Derived (Non-primitive)
Datatype
25
1. Fundamental Data type
The data items that cannot be
decomposed of.
There are five such data
types :
int for integers
float for real numbers
char for characters
double
precision for real numbers
with higher
26
integer Data type
Approx. size
Type Minimal range
( in bytes)
Approx. size
Type Minimal range
( in bytes)
Approx. size
Type Minimal range
( in bytes)
1. I/O
2. Arithmetic
1. Increment
3. Relational
2. Decrement
4. Logical Conditional Operator
3. Unary minus
5. Bitwise
4. Sizeof() operator
6. Shift
Increment / Decrement
Syntax:
for(initialization_expression;
conditional_expression;
update_expression)
{
body of the loop;
}
while loop
Syntax:
Initialization statatement;
while(conditional_expression)
{
body of the loop;
updating statement;
}
do while loop
Syntax:
Initialization statement
do
{
body of the loop;
updating statement;
}
while(conditional_expressi
on);
Nested Loop