DATA TYPES
Our interactions (inputs and outputs) of a program are treated in many languages as a stream of bytes. These bytes represent data that can be interpreted as representing values that we understand. Additionally, within a program we process this data that can be interpreted as representing values that we understand. Additionally, within a program we process this data in various way such as adding them up or sorting them. This data comes in different forms. Examples include: your name which is a string of characters; your age which is usually an integer; or the amount of money in your pocket which is usually a value measured in dollars and cents (something with a fractional part). A major part of understand how to design and code programs in centered in understanding the types of data we want to manipulate and how to manipulate that data.
A type defines a set of values and a set of operations that can be applied on those values. The set of values for each type is known as the domain for that type. The four major families of data include:
• Nothing
• Integer
• Floating-point
• Complex
The C++ programming language identifies five data types as standard data types:
• Void
• Boolean
• Character
• Integer
• Floating-point
The standard data types and the complex data types within C++ have a series of attributes, which include:
• C++ Reserved or Key Word
• Domain – the allowed values
• Signage – do they allow negative numbers or only positive numbers
• Meaning – i.e What do they represent
• Rules of Definition – What special characters indicate the data type
• Size – in terms of the number of bytes of storage used in the memory
• Operations Allowed – i.e. Which operators can I use on the data type
Family Data Type Reserved Word Represents Standard Type
Nothing Null or nothing void No data Yes
Integer Boolean bool Logical true and false Yes
Integer Character char Single characters Yes
Integer Integer int Whole numbers Yes