Zusammenfassung der Ressource
2.2 Programming
- KEY WORD
- Input, Output, Assignment, Psuedocode,
Flowchart, Identifier, Variable, Constant,
Concatenation, Memory Location, Parameters
- INPUT
- Inputs come from the console, from a file,
or from elsewhere in a modular program
– then they are known as 'parameters'
- OPERATORS
- Numbers: addition, subtraction, division, modular
division (division with a remainder), integer
division, multiplication, to-the-power-of, negation
Boolean: AND, OR, NOT, larger, smaller, equal, not
equal Strings/characters: slicing, length, format
- INTEGERS AND REALS
- Addition total = amount + VAT Subtraction e.g.
age = cur_year – y_birth Division divide = 5 / 2
Modular division myRemainder = 5 MOD 2 (find a
remainder) Integer division intDivision = 5 DVI 2
Multiplication totalCost = cost * 0.2 Exponential
area = 3.1 * radius^2
- STRING OPERATIONS
- String Features Slicing e.g. LEFT(“monkey”,4) is
“monk” Length e.g. LEN(“monkey”) [=6] Change
case e.g. “monkey””MONKEY””Monkey”
Formatting Features ASCII and Unicode e.g.
ASCII(“c”) [=99] Escape characters e.g. ‘it\’s me’ [it’s
me] White space: CR NewLine, TAB 4 or 5 spaces
- BOOLEAN OPERATORS
- AND - two conditions must be true for the
statement to be true OR - at least one
condition must be true for the statement to be
true NOT – inverts the result, e.g. NOT(A and B)
will only be false when both A and B are true
- WHAT, OPERATORS ARE USED WHERE?
- Numbers: addition, subtraction, division, modular division (division with a
remainder), integer division, multiplication, to-the-power-of, negation Boolean: AND,
OR, NOT, larger, smaller, equal, not equal Strings/characters: slicing, length, format
- EOL
- EOL means end of line
- MORE KEY WORDS
- Sequence, algorithm, Instructions,
Efficiency, Structured
- BENEFITS OF SEQUENCING
- Each line follows the next Create
simple programs very quickly Easy to
follow for a small program
Fundamental principal of a program
- DISADVANTAGES OF
SEQUENCING
- Not at all efficient Becomes very
difficult to follow with large programs
Extremely hard to maintain
- KEY WORDS
- IF, ELSIF, ELSE, SELECTION CASE,
Boolean, nested, selection, condition,
criteria, true, false
- NESTED SELECTION
- Sometimes, we can only evaluate a
condition if some pre condition is
met. We would need two selection
statements on inside the other.
- BIG PICTURE
- Computers are good at performing
- EOF
- EOF means end of file
- SQL
- SELECT(fields) . FROM(files) . WHERE
- BOOLEAN
- Boolean can only have two values, example TRUE
or FALSE...
- FILE MODE
- A file can open in either READ or WRITE modes.