Note: Except array, all are called "Abstract" data structures
e.g. Employee Record
TYPE TEmployeeRecord DECLARE FirstName: STRING DECLARE LastName: STRING DECLARE DateEmployed: DATE DECLARE Salary: CURRENCY ENDTYPE
To Access:
DECLARE Sam : TEmployeeRecord Sam.FirstName <- "Sam" Sam.DateEmployed <- #12/04/1995# Sam.Salary <- 4100
Set
TYPE DictionaryEntry
DECLARE Key: STRING
DECLARE Value: STRING
ENDTYPE
DECLARE EnglishFrench[0:9999] : DictionaryEntry
TO INSERT:
EnglishFrench["Hello"] <- "Bonjour"
TO LOOKUP:
print(EnglishFrench["Hello"])
TYPE TGameRecord PlayerID: STRING (20) GameTime: DATETIME RoundsFired: INTEGER Accuracy: FLOAT ENDTYPE
Consider we need to store the following record on server:
Group activity
Define how data should store for 3 game records in a file, using plain text file
Discussion Time
What is the advantages and disadvantages for binary file over text file?
Discussion Time
Advantage and disadvantages of direct-access?
| Sign | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 | 2^-1 | 2^-2 |
|---|
Decimal point
Questions:
Discussion Time
In modern computers we usually have 64-bit number (integer/real)
Fixed point representation is straightforward and easy to understand, but what is the limitations?
| Denary | Floating point notation |
|---|---|
| 25.3 | |
| 13475 | |
| -12.9 | |
| 0.123 | |
| 0.00254 | |
| -0.00195 |
| Denary | Normalised floating point notation |
|---|---|
| A | |
| A | |
| A | |
| B | |
| B | |
| B |
Your turn
Exchange notebook and put 3 denary and 3 floating point notation value in A and B respectively, return to the owner and they need to answer them
Example: 12-bit floating point
with 8-bit M, 4-bit E