There are several types of data used in a code, all with different characteristics, uses and parameters. The main basic types are: characters, integers, floating points and boolean. In order to determine the type of data, one must first declare a variable which is done by writting:

Type NameofVariable;

Type would be:

Character: Characters are any symbol such as letters or numbers. They are declared by writting char and at they aren’t recommended to be used in operations since they only represent a character. They are useful if you wish to input a symbol. In case you want to input a message or code you could use a string in which case you would need to include the library string. 

Integer: Any number without decimals. They are declared by writting the type int and are useful for mathematical operations and determining conditionals. In case a value with a decimal is declared as an int, the program will turn it to the lower bound, for instance 1.999 would be 1. 

Floating Point: A floating point is any number, including decimals. They are declared by writting float or in case of a bigger number double. They are useful in cases which require precision with numbers such as the area of a circle or a logarithm. 

Boolean: Might only hold a value of 1 or 0. It’s declared by writting bool before the name of the variable. They are useful in conditionals, to determine wether an action should be done or not by acting as a true or false statement. 

Here’s an example of the types in a code:

 

I did a research and found this page which explains the types and their parameters: http://www.cplusplus.com/doc/tutorial/variables/

Thanks for watching!

CC BY 4.0 Types and uses #Mastery9 by Carlos Gallegos is licensed under a Creative Commons Attribution 4.0 International License.