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.
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.
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.
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.