A character used in C++
C++ consists of alphabets, Digits, and Special characters.
1- Letters:
Upper case letters:
A,B,C,D---------------------Y, Z
Lower case letters:
a,b,c,d------------------------y,z
2-Decimal digits:
0.1.2.34.5---------------------7,8,9
3-Special Character:
!,@,#,%,&,*(),{},[],;,'',"",<>,|,\,/,?------
Basic DataTypes in c++
Every program consists of some data in particular sequences. he data can be of many types such numbers characters, Boolean and etc. Datatypes have the ability to define the range and set of operations that could be applied to data.
The Basic datatypes supported by C++
Integers: An integer is a whole number without a decimal point. these numbers are used for counting.
Example of some valid integers are: 525, 326, 456, 36565, 454
C++ supports two types of integers: ' int' and 'long'. These types are used for normal and extremely large values.
Floating Points: A floating number has a decimal point. These numbers are used for measuring quantities. Example of some valid floating numbers are: 45.5, 65.36, 4589.65
C++ supports three types of floating points: 'float','double',and 'long double'.They can hold value in increasing value.
Character (char) : It is alphanumeric characters. Example of some valid characters are 'A','3','a','&'and etc.
Data Types Modifier's
Integer's
Modifier | Range of values | Memory size(Bytes) |
---|---|---|
short | -32,768 to 32,767 | 2 |
signed short | -32,768 to 32,767 | 2 |
unsigned short | 0 - 65,535 | 2 |
int | same as short | 2 |
unsigned int | same as unsigned short | 2 |
signed int | same unsigned short | 2 |
long | - 2,147,438,648 | 4 |
Floating points
Modifier | Range of values | Memory size (Bytes) |
---|---|---|
Float | 3.4*10-38 to 3.4*10 38 | 4 |
Double | 3.4*10-38 to 3.4*10 38 | 8 |
Long Double | 1.7*10-30 | 10 |
Character
Modifier | Range of values | Memory size (Bytes) |
---|---|---|
char | -128 to 127 | 1 |
signed char | -128 to 127 | 1 |
unsigned char | 0 to 255 | 1 |
C++ Tokens
A token is a group of characters that belong together any statement in c++ contains tokens Example if, for, while and etc. C++ supports four types of tokens.
- Identifiers
- Keywords
- Constants
- Operators
An identifier is a symbolic name that refers to data or object which the programmer used in his program. For example, a programmer wants to store a value 27 in a memory location the program must choose a symbolic name.
The symbol ' = ' is used as an assignment operator that stores the value 27 into a memory location.
NUM = 27;
- An identifier consists of digits, alphabets, and underscores.
- It must not start with a digit.
- C++ is case sensitive language.
- An identifier can start with _Underscore
A keyword is a reserved word of c++. This cannot be used as an identifier in a program.
2 Comments
Nice
ReplyDeleteThis method of teaching is very good i understand
ReplyDelete