PASCAL
Arithmetic
Arrays
Boolean Operators
Case
Comparisons
Declarations
Field Width + Precision
Functions
Identifiers
Loops
Order of Operations
Procedures
Records
Recursion
Searching
Sets
Sorting
Standard Arithmetic Functions
The Maze
Writing Lines
= = = = Identifiers = = = =
==> Not case sensitive
==> Only the first 8 characters matter (ex: "WeightAtStart" is equivalent to "WeightAtEnd")
CANNOT...
| STATEMENT | OUTPUT |
| writeln(X:8:2) | ,,123.45 |
| writeln(Y:8:1) | ,,,,-9.9 |
| writeln(-45.67:12:6) | ,,-45.670000 |
| Identifier | Function | Example |
|---|---|---|
| SQR | squaring | ex: sqr(3)=9 |
| SQRT | square root | ex: sqrt(4)=2 |
| ABS | absolute value | ex: abs(-4)=4 |
| SIN | Note: Input in RADIANS Note: Pi radians = 180� |
|
| COS | ||
| TRUNC | eliminates post-decimal numbers | ex: trunc(7.12)=7 ex: trunc(7.99)=7 |
| ROUND | rounds to integer | ex: round(7.12)=7 ex: round(7.99)=8 |
| ODD | boolean function => true implies odd entry, false implies even entry | |
| PRED | predecessor function | ex: pred(7)=6 |
| SUCC | successor function | ex: succ(7)=8 |
| P | Q | P and Q | P or Q | not P |
|---|---|---|---|---|
| T | T | T | T | F |
| T | F | F | T | F |
| F | T | F | T | T |
| F | F | F | F | T |