1 / 12

By the end of this lesson you should be able to...

By the end of this lesson you should be able to. Define the terms variable and constant as used in an imperative language. Use variables and constants. Describe the data types integer, real, Boolean, character and string. Select and justify appropriate data types for a given program.

pisces
Télécharger la présentation

By the end of this lesson you should be able to...

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. By the end of this lesson you should be able to... • Define the terms variable and constant as used in an imperative language. • Use variables and constants. • Describe the data types integer, real, Boolean, character and string. • Select and justify appropriate data types for a given program. • Perform common operations on numeric Boolean data. • Use one-dimensional arrays.

  2. Important! • Write the date at the top of a new page at the start of every lesson • When you see the pen symbol, you must copy down what is on the board. • Your book will be checked regularly, it must be presentable. • When you see the book symbol with a page number, you should turn to that page in your text book. Page: 00

  3. Key terms • Variable • Constant • Integer • Real • Boolean • Character • String For each key term write the definition and give an example of it being used Page: 168

  4. Selecting the correct variable Complete the table above, give reasons for your answers.

  5. Operators • The mark scheme states that you must perform common operations on numeric and Boolean data. • This is very similar to what you might do in Microsoft Excel or Access but we now can use operators in pseudocode.

  6. Common Operators

  7. Operators in use Less than Get temperature IF temperature <19 THEN Switch heating ON ELSE IF temperature >20 THEN Switch heating OFF ENDIFENDIF Greater than

  8. Quick Question • What could be done to the pseudocode on the previous page to improve it (think about the operators being used). • Write a piece of pseudocode that makes use of several operators.

  9. Arrays • An array allows a list of related data to be stored. • For example a program that stores user names and high scores up to 20 could look at little like the code below. DIM Name(20) As String DIM Score(20) As Integer FOR j = 1 TO 20 INPUT Name (j) INPUT Score (J) Next J

  10. Key terms • ASCII (American Standard Code for Information Interchange) – 7 bit system to code the character set of a computer. • CHR - Uses the ASCII value to look up the character associated with a particular number. • Concatenation – Combining two strings into a single string.

  11. Manipulating strings • We can manipulate an array that contains a string by using terms such as length, left and right, mid, instring ASC and CHR. Task • Using your textbook (pages 181 – 183) answer the questions on page 183.

  12. Exam Questions • What is a variable? • Why do we use constants in programs? • What value will be assigned to the variable x if: • X = 11-3*5 • X – 8*2/4 • X = 8/(3-1) • X = 19MOD 5*2 • What will be returned by the following comparisons? • Num1<>Num2 if Num1 = 6 and Num2 = 3 • Num1>=Num2 if Num1 = 3 and Num2 = 3

More Related