NCERT Computer: Chapter 7 – Introduction to C + + Part 2
3 C++ Character Set
Character set is a set of valid characters that a language can recognised. A character represents any letter, digit or any other special character.
The C++ has the following character set.
4 Basic Data Types
Every program specifies a set of operations to be done on some data in a particular sequence.
However, the data can be of many types such as a number, a character, boolean value etc. C++ supports a large number of data types.
1 Integer Type (Int)
An integer is an integral whole number without a decimal point.
These numbers are used for counting. These numbers are used for counting.
Normally an integer can hold numbers from -32768 to 32767.
However, if the need be, a long integer (long int) can also be used to hold integers from -2, 147, 483, 648 to 2, 147, 483, 648.
2 Floating Point Type (Float)
A floating point number has a decimal point.
Even if it has an integral value, it must include a decimal point at the end. These numbers are used for measuring quantities.
Examples of valid floating point numbers are:
A float type data can be used to hold numbers from with six or seven digits of precision
However, for more precision a double precision type (double) can be used to hold numbers from with about 15 digits of precision.
3 Character Type ((Char)
It is a non-numeric data type consisting of single alphanumeric character. Examples of valid character types are : ‘A’, ‘9’, ‘P’, ‘8’, ‘&’.
It may be noted here that 9 and ‘9’ are of different data types.
The former is of type int and later of type char.