Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Types Mr Tottman Link. Data Types Programs need to use data for calculations and for output to various devices The best programs will always use.

Similar presentations


Presentation on theme: "Data Types Mr Tottman Link. Data Types Programs need to use data for calculations and for output to various devices The best programs will always use."— Presentation transcript:

1 Data Types Mr Tottman Link

2

3 Data Types Programs need to use data for calculations and for output to various devices The best programs will always use the most appropriate data types to make the most effective use of memory and to ensure that only the correct types of data are allowed to be input

4 Variables A variable can be declared to have a data type including: Character String Integer Real Boolean

5 Character Allows any single letter or number Example R

6 String Allows any combination of letters, numbers and spaces Example R C Taylor A text or string data type can hold any alphanumeric. The data can be pure text or a combination of text, numbers and symbols. Examples Address – 110 Station Road Telephone Number – 01424 772155 NOTE: people often assume that a telephone number would be stored as an 'integer' data type. After all, they do look like numbers don't they! But think about it... Telephone numbers need to be stored as a text/string data type because they often begin with a 0 and if they were stored as an integer then the leading zero may not be stored. The other reason is that you are never likely to want to add or multiply telephone numbers so there is no reason to store it as an integer data type.

7 Integer Whole numbers only Example 356 An ‘Integer’ data type stores whole numbers. The numbers can be both negative or negative but cannot contain fractions or decimals p

8 Real For numbers that include fractions or decimals Example 4.43 A ‘Real’ Data type is Numerical Data which contains decimals or Fractions It would be used when extra detail is required and a whole number would not provide enough information. Examples of where ‘Real’ data type is used can be seen below Weight in Kg – 12.25, 19.99, 176.23 etc Room Measurement in metres - 4.24, 3.87 etc Temperature (Degrees Celsius) – 32.2, 37.7 etc Note that the ‘real’ data types cannot store the measurement symbols themselves (£,$ etc) nor the type of quantity being measured (metre, Kg etc) Also note that currency can be either a ‘real’ or an integer data type

9 Boolean Can only be TRUE or FALSE Example TRUE/false Yes/no 0/1 A Boolean data type is used to answer questions where there are exactly two options, three options would mean that it is no longer Boolean. Here are some example questions where the responses would be stored as Boolean data: Has the Heating been turned on? Yes / No Are you employed? Yes / No

10 Quiz Link1 Link Link 2 Quiz Home Page


Download ppt "Data Types Mr Tottman Link. Data Types Programs need to use data for calculations and for output to various devices The best programs will always use."

Similar presentations


Ads by Google