Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo

1

Presented by
• Divya Sree
• Rayshini
• Issac
• Mahender
TOKENS

2

 Tokens are the basic building blocks in C++ language.
The smallest individual units in a program are known as
tokens.
 A program is constructed using a combination of these
tokens.
TOKENS

3

Keywords
Variables
Constants
Strings
Operators
FIVE TYPE OF TOKENS

4

Keywords
Variables
Constants
Strings
Operators
FIVE TYPE OF TOKENS

5

Definition:
Sequence of characters that have a fixed
meaning.
 Keywords must be written in lower
case.
 Reserved identifiers and can’t be used
as names for the
 program variables
 user-defined program elements.
KEY WORDS
Examples:
int, float, char,
double, switch,
break, char, const,
Continue, default,
for, if, goto, static,
void, sizeof, while,
return, int, long, do,
while etc…

6

Keywords
Variables
Constants
Strings
Operators
FIVE TYPE OF TOKENS

7

Definition:
A variable is a quantity
whose value may
change during the
program execution.
Examples:
int a, char choice, etc.,
VARIABLES
Variables in
C++
Numeric
Variables
To store either integer
values or floating
point values
Character
Variables
Alphabets and
numbers from 0-9
inserted between
single quotes

8

 Naming Conventions:
A variable name should
• contain alphabets (a-z , A-Z) and digits (0-9).
• not start with a number or a digit.
• not be a keyword.
• case sensitive.

9

 Naming Conventions:
A variable name should
• contain alphabets (a-z , A-Z) and digits (0-9).
• not start with a number or a digit.
• not be a keyword.
• case sensitive.

10

Keywords
Variables
Constants
Strings
Operators
FIVE TYPE OF TOKENS

11

CONSTANTS
Definition: The quantities whose value do not change
during the program execution are known as constants.

12

Keywords
Variables
Constants
Strings
Operators
FIVE TYPE OF TOKENS

13

Definition:
A group of characters that are treated as a single data
item enclosed in double quotes are known as strings.
General syntax:
• char string-name[size];
• size determines the number of characters in the string
name.
Example: char city[9]=“New York”;
STRINGS

14

Keywords
Variables
Constants
Strings
Operators
FIVE TYPE OF TOKENS

15

Definition:
An operator is a symbol that performs
operations on one or more operants.
There are 8 types of operators supported by C++
language.
OPERATORS

16

• Arithmetic operators (+,-,*,/,%)
• Relational operators (==,!=,<,>,<=,>=)
• Logical operators (||,&&,!)
• Conditional operators (? :)
• Assignment operators (=,+=,-=,/=,*=,%=,)
• Increment /decrement operators (++,--)
• Bitwise operators (&,|,^,<<,>>,~)
• Miscellaneous/special operators (sizeof,*,->)
EIGHT TYPES OF OPERATORS

More Related Content

Tokens in C++