5. Other Data Types

In C++, there are many different data types that are included in the programming language, known as “Primitive” data types. Some of these we have already gone over: int and double. The other primitive types are described below:

Boolean is probably the easiest to understand. A boolean has two options for its value: true and false. These are essentially the ones and zeros that are stereotypical of computer programming: on or off, yes or no, true or false. When initializing a boolean, “bool” is used, in the same way “int” is used for an integer. We will talk about its uses a bit more in a couple paragraphs. This syntax can be summarized as: 

A character is another simple data type, as it consists of a single letter, number, or symbol on your keyboard. Examples of this include “a” or “A” (which are considered different!), as well as ! or ~. When initializing a character, char is used. 

Further data types that are available include other floating point data types (those that can hold real numbers as opposed to simply integers) of which include doubles, and those that include “strings” of characters, and thus are called strings. We will not be working with strings for now but it is useful to know that although they are not a primitive (a predefined) data type in C++, they are used extremely often.