Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming recap. Do you know these? LOW LEVEL 1 st generation: machine language (110011) 2 nd generation: assembly language (ADD, SUB) HIGH LEVEL 3.

Similar presentations


Presentation on theme: "Programming recap. Do you know these? LOW LEVEL 1 st generation: machine language (110011) 2 nd generation: assembly language (ADD, SUB) HIGH LEVEL 3."— Presentation transcript:

1 Programming recap

2 Do you know these? LOW LEVEL 1 st generation: machine language (110011) 2 nd generation: assembly language (ADD, SUB) HIGH LEVEL 3 rd / 4 th generation: E.g. Pascal, C++, Java

3 How about these? Source code: original instructions Object code: machine language version Compiling: converting from source to object Linking: bring all data together before running Executing: running the program Maintaining: ensuring program continues to run

4 Do these errors ring a bell? Syntax error: error with the use of the language Logic error: error when something is out of sequence or doesn’t make sense (e,g, sum = a * b) Runtime error: error when program runs Testing: checking for errors Debugging: Fixing errors

5 Types of statements Assignment Calculation Input Output Looping Selection/condition Program header Vat:= 0.15 Vat:=price * tax Read(age) Write(age) For age:= 1 to 5 do While age<65 do If age > 65 then Program OLDAGE;

6 Symbols symbols symbols ; means end of line { } is used to put comments that are not a part of the program := means equals. Means end of program > more than < less than <> not equal to = is equal to >= more than or equal to

7 What are datatypes? Integer – whole number (90) Real – decimal number (9.67) Char – single letter (n) String – word (nine) Array – a list

8 Declaring an array Declare an array named class that has 20 spaces and stores the names of persons CLASS:array[1..20] of STRING; Name of array Number of spaces datatype

9 Working with arrays Output the fourth value in CLASS ◦ Writlen(CLASS[4]); Input a value into the 10 th space in class ◦ Readln(CLASS[10]); Input the name “george” into the 8 th position in CLASS ◦ CLASS[8]:=“george”;

10 Tracing a program – Jan 2013, #9 a) Pascal b) Sequence. c) Output d) The result is 12 e) Set A = no error Set B = runtime error. Because num1 is 2.5. This is a real number.

11 Boolean – ones and zeros! AND 000 010 100 11 1 OR 000 01 1 10 1 11 1

12 Documentation?? External documentation ◦ Use manuals ◦ Installation procedures ◦ Frequently asked questions Internal documentation ◦ Comments in your program ◦ Indenting so your program is neat


Download ppt "Programming recap. Do you know these? LOW LEVEL 1 st generation: machine language (110011) 2 nd generation: assembly language (ADD, SUB) HIGH LEVEL 3."

Similar presentations


Ads by Google