
You are watching: The numeric data types in c++ are broken into two categories:
Although C++ offers plenty of data types, in the very broadest feeling there are only two: numeric and character. Numeric dara types are broken into two added categories: integer and floating point. Integers are entirety numbers choose 12, l57, -34, and also 2. Floating-point numbers have a decimal point, prefer 23.7, 189.0231, and also 0.987.
Integer Data Types
Integer variables deserve to only hold entirety numbers.
integer Example

NOTE:The data kind sizes and ranges presented in Table 2-6 are typical on countless systems. Relying on your operating system, the sizes and ranges might be different.Literals: Any consistent value written in a program.The sizeof operator will certainly report the variety of bytes the memory offered by any data form or variable.
Integer Examples
0000 | 0 | 0000 | 0 | 1000 | -8 |
0001 | 1 | 0001 | 1 | 1001 | -7 |
0010 | 2 | 0010 | 2 | 1010 | -6 |
0011 | 3 | 0011 | 3 | 1011 | -5 |
0100 | 4 | 0100 | 4 | 1100 | -4 |
0101 | 5 | 0101 | 5 | 1101 | -3 |
0110 | 6 | 0110 | 6 | 1110 | -2 |
0111 | 7 | 0111 | 7 | 1111 | -1 |
1000 | 8 | 0 suggests positive | 1 suggests negative | ||
1001 | 9 | ||||
1010 | 10 | ||||
1011 | 11 | ||||
1100 | 12 | ||||
1101 | 13 | ||||
1110 | 14 | ||||
1111 | 15 |
Overflow
Overflow is the case where you shot to save a number that exceeds the best range for the data type. As soon as you try to store too large of a hopeful or an adverse number, the binary depiction of the number is corrupted and also you obtain a meaningless or erroneous result.Underflow
Underflow is the case where you shot to save a number the exceeds the minimum range for the data type. As soon as you try to save too tiny of a confident or an adverse number, the binary depiction of the number is corrupted and you gain a meaningless or erroneous result.Floating-Point Data Type
Floating-point data varieties are provided to specify variables that have the right to hold real numbers.In C++, there room three data varieties that deserve to represent floating-point numbers.floatdoublelong double
Floating-Point Data Example

NOTE:There space no unsigned floating-point data types. On all machines, variables of the float, double, and also long twin data types can store optimistic or an unfavorable numbers.Computers generally use E notation to represent floating-point values. In E notation, the number 47,281.97 would certainly be 4.728197E4. The component of the number before the E is the mantissa, and also the component after rhe E is the power of 10. When a floating-point number is save on computer in memory, it is stored together the mantissa and also the power of 10.
The Char Data Type
The char data type is supplied to store individual characters. A varaible of the char data form can hold one personality at a time. Although the char data kind is supplied for save on computer characters, that is actually an integer data type that commonly uses 1 byte the memory. (The dimension is mechanism dependent. On part systems, the char data form is larger than 1 byte.)The factor an essence data type is offered to store personalities is due to the fact that characters room internally stood for by numbers. Every character is assigned a unique number.See more: Yeh Un Dinon Ki Baat Hai Cast, Yeh Un Dinon Ki Baat Hai Season 2 Cast
The most commonly used an approach for encoding personalities is ASCII, which represents the American typical Code for info Interchange.When a personality is srored in memory, that is in reality the numeric code that is stored. As soon as the computer system is instructed to print the worth on the screen, it screens the character that synchronizes with the numeric code.
The Char Data Example

The bool Data Type
Expressions that have actually a true or false value are referred to as Boolean expressions. Boolean variables are set to one of two people true or falseThe bool Data Example

NOTE:The value true is represented in storage by the number 1, and also false is stood for by 0.Boolean values are helpful for evaluating problems that space either true or false.When the boolalpha format flag is set, bool values room inserted/extracted by your textual representation: either true or false , instead of integral values.
Declaring Variables through the auto crucial Word
* C++ 11 introduces an alternative method to define variables, making use of the auto an essential word and an initialization value. Here is one example:       auto lot = 100; ← int
* The auto crucial word tells the compiler to determine the variable"s data kind from the initialization value:      auto interestRate = 12.0; ← double