1 / 12

Programming recap

Programming recap. 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. How about these?. Source code: original instructions

lieu
Download Presentation

Programming recap

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming recap

  2. Do you know these? • LOW LEVEL • 1st generation: machine language (110011) • 2nd generation: assembly language (ADD, SUB) • HIGH LEVEL • 3rd / 4th 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 symbolssymbols • ; 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; datatype Name of array Number of spaces

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

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

  11. Boolean – ones and zeros! OR AND

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

More Related