Presentation is loading. Please wait.

Presentation is loading. Please wait.

I Power Int 2 Computing Software Development High Level Language Constructs.

Similar presentations


Presentation on theme: "I Power Int 2 Computing Software Development High Level Language Constructs."— Presentation transcript:

1 I Power Int 2 Computing Software Development High Level Language Constructs

2 Simple Data Types Some of the types of variables used include: String Real Integer Boolean

3 Strings String variables contain text and can take up a range of memory. Two operations that can be applied are: Concatenation. Substrings.

4 Concatenation Concatenation is the addition of two strings. One string is placed at the end of the other. Forename$ = “Bob” Surname$= “Jones” Fullname$ = Forename$ + Surname$ The Variable Fullname$ will now contain: “BobJones”

5 Substrings Substrings are often referred to as string slicing. This is where the part of the string is extracted. A Variable Fullname$ may contain: “BobJones” Forename$ := Fullname$(1:3) Surname$ := Fullname$(4:8) Forename$ now contains “Bob” and Surname$ now contains “Jones”

6 Real Real numbers are floating point numbers. They usually use 32bits of computer memory. Remember: E.g. 20.125 =.20125 x 100 =.20125 x10 2 Any number can be represented in the form: M x base e Where M is the mantissa and e is the exponent.

7 Integer An Integer is any positive or negative whole number. Integers usually use 32bits of computer memory. All mathematical operations can be applied to these numbers. E.g. + - x /

8 Boolean A Boolean value can have either the value True or False. Their value is stored using one bit of memory. Logical operators can be used on Booleans E.g. AND, OR, NOT.

9 Arrays This is a set of data items of the same type grouped together with a single variable name. Each Data item (Element) in the array is identified by the variable name and a subscript (index). An array of names may look like this: Name(1) Contains John Name(2) Contains Helen Name(2) Contains Peter

10 Decision Making All languages have some decision-making construct. IF, where the execution of an action depends on a stated condition. Most languages expand this to allow for a series of outcomes using: IF…THEN…ELSE…

11 Decision Making (Cont.) Nested IF IF mark >= 70 then PRINT “A” ELSE IF mark >= 60 then PRINT “B” ELSE IF mark >= 50 then PRINT “C” ELSE IF mark >= 45 then PRINT “D” ELSE PRINT “No Award” END IF

12 Modules Modules can take many different form depending on the language. Functions; This is similar to a subroutine except that it has a value that can be assigned rather than returning a variable.

13 Parameter passing by value (In Parameter) When a parameter is passed by value into a subroutine an exact copy of current value of the original variable is used by the subroutine. This allows one-way data transfer between the main program and the subroutine. The programmer can then guarantee that the variable will still be suitable for other parts of the code.

14 Passing by value (Example) The Value of the parameter stored at location 5000 is passed by value. Memory Locations 5000 5001 5002 A copy of the value is stored at location 5001 Simon The subroutine is then free to change the value in 5001 The value of the original remains unchanged. Simon Paul

15 Parameter Passing by Reference (In/Out Parameter) Parameter passing by reference allows the data that is passed into a subroutine to be changed, then passed back out to other parts of the program. This allows a two way data transfer between the main program and the subroutine.


Download ppt "I Power Int 2 Computing Software Development High Level Language Constructs."

Similar presentations


Ads by Google