| Type | Size (typical) | Range / Use |
|---|---|---|
| bool | 1 byte | true / false |
| char | 1 byte | -128 to 127, one character |
| int | 4 bytes | about ±2.1 × 109 |
| long long | 8 bytes | about ±9.2 × 1018 |
| float | 4 bytes | ~7 decimal digits |
| double | 8 bytes | ~15 decimal digits |
| string | varies | text (std::string) |
cout << sizeof(int) << endl; // 4
cout << sizeof(long long) << endl; // 8
cout << INT_MAX << endl; // 2147483647 (needs <climits>)
Type casting: (double)a / b or static_cast<double>(a) / b gives a decimal result; a / b with two ints drops the fraction.