Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review Binary –Each digit place is a power of 2 –Any two state phenomenon can encode a binary number –The number of bits (digits) required directly relates.

Similar presentations


Presentation on theme: "Review Binary –Each digit place is a power of 2 –Any two state phenomenon can encode a binary number –The number of bits (digits) required directly relates."— Presentation transcript:

1 Review Binary –Each digit place is a power of 2 –Any two state phenomenon can encode a binary number –The number of bits (digits) required directly relates to the amount of physical resource required –Bit, Byte, 1K, 1Meg

2 Review Integers –Simple whole numbers –How many bits required to contain an integer The power of 2 just larger than that integer Floating point –Numbers with decimal points –Numbers with exponents –Can represent very large and very small numbers

3 Review Numeric expressions (+ - * /) 1+2 3*4 + 7 6.2/(4.2-2.2) Boolean (true, false) (, =, ==, !=) 1 > 2 (3*5) <= 17

4 Review Characters –Every character corresponds to a unique number –Sorting order –ASCII - encodes all American English characters (1 byte) –UNICODE encodes all commercially used characters in the world (2 bytes)

5 Programs Variables Assignment Sequences of instructions

6 Variables A named place to store a value Assignment George = 32; Size = 17; Weight = 120;

7 Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1;

8 Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1;

9 Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1; A + 13 75 + 13 = 88

10 Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1; A-B+3 75 - 88 + 3 = -10

11 Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1; A / 2 + 1 -10 / 2 + 1 = -4

12 Program Quiz Do each in sequence Fred = 2*7; Jane = 16; Fred = Jane - Fred; Jane = Fred/2;

13 Program Quiz Do each in sequence Fred = 2*7; Jane = 16; Fred = Jane - Fred; Jane = Fred/2;

14 Program Quiz Do each in sequence Fred = 2*7; Jane = 16; Fred = Jane - Fred; Jane = Fred/2;

15 Program Quiz Do each in sequence Fred = 2*7; Jane = 16; Fred = Jane - Fred; Jane = Fred/2; Jane - Fred 16 - 14 2

16 Program Quiz Do each in sequence Fred = 2*7; Jane = 16; Fred = Jane - Fred; Jane = Fred/2; Jane - Fred 16 - 14 2

17 Program Quiz Do each in sequence Fred = 2*7; Jane = 16; Fred = Jane - Fred; Jane = Fred/2;

18 Arrays Access by Index A B

19 Arrays Access by Index A[0] = 7; B[1] = 4; B[2] = A[0]+1; A[1] = B[2]/2; A[3] = 7-B[1]; A B

20 Arrays Access by Index A[0] = 7; B[1] = 4; B[2] = A[0]+1; A[1] = B[2]/2; A[3] = 7-B[1]; A B

21 Arrays Access by Index A[0] = 7; B[1] = 4; B[2] = A[0]+1; A[1] = B[2]/2; A[3] = 7-B[1]; A B

22 Arrays Access by Index A[0] = 7; B[1] = 4; B[2] = A[0]+1; A[1] = B[2]/2; A[3] = 7-B[1]; A B

23 Arrays Access by Index A[0] = 7; B[1] = 4; B[2] = A[0]+1; A[1] = B[2]/2; A[3] = 7-B[1]; A B

24 Arrays Access by Index A[0] = 7; B[1] = 4; B[2] = A[0]+1; A[1] = B[2]/2; A[3] = 7-B[1]; A B

25 Strings An array of Characters A=“Lloyd”; B= “Big”; B[2] = A[0]+1; A B

26 Strings An array of Characters A=“Lloyd”; B= “Big”; B[2] = A[0]+1; A B

27 Strings An array of Characters A=“Lloyd”; B= “Big”; B[2] = A[0]+1; A B

28 Strings How do you put “ in a string? Special characters preceded by \ A=“Lloyd”; B= “Big”; B[2] = A[0]+1; B = “\”P\\” A B

29 Sound Each time samples the volume (amplitude) Sound = array of volume values

30 2D-Arrays Rows Columns [Rows-1,Columns-1] [0,0] # of elements = Rows * Columns 5 10 [4,9] 5 * 10 = 50

31 Images - 2D array of values Image [x,y]


Download ppt "Review Binary –Each digit place is a power of 2 –Any two state phenomenon can encode a binary number –The number of bits (digits) required directly relates."

Similar presentations


Ads by Google