Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

PHY-206

CPNA

Dr M. Arifur Rahman
Associate Professor
Content

 Fundamental Types
 Constants
 Escape Sequences
 Names
 Variables
 The Keywords const and volatile

11/17/20 A Complete Guide to Programming in C++ 2


Types of Variables

11/17/20 A Complete Guide to Programming in C++ 3


Integer Type Variables

11/17/20 A Complete Guide to Programming in C++ 4


Floating Type Variables

11/17/20 A Complete Guide to Programming in C++ 5


Constants

 Boolean constants
 Ex: True/False
 Numerical constants
 Ex: 719, 0135, 0x2AC2, 0X129D
 Floating point constants
 Ex: 27.1, 1.8E–2
 Character constants
 Ex: A, a, c
 String constants
 Ex: "Today is a beautiful day!"

11/17/20 A Complete Guide to Programming in C++ 6


Escape Sequence

11/17/20 A Complete Guide to Programming in C++ 7


Escape Sequence: Example

11/17/20 A Complete Guide to Programming in C++ 8


Keywords

11/17/20 A Complete Guide to Programming in C++ 9


Identifiers

 a name contains a series of letters, numbers, or


underscore characters ( _ ).
 C++ is case sensitive; that is, upper- and lowercase
letters are different.
 the first character must be a letter or underscore
 there are no restrictions on the length of a name
 All the characters in the name are significant
 C++ keywords are reserved and cannot be used as
names.
 German umlauts and accented letters are invalid.

11/17/20 A Complete Guide to Programming in C++ 10


Ex:

11/17/20 A Complete Guide to Programming in C++ 11


Global and Local Variables

11/17/20 A Complete Guide to Programming in C++ 12

You might also like