lecture3.arrays

lecture3.arrays - Media Software Design DIG 3134 - Lecture...

This preview shows pages 1–22. Sign up to view the full content.

1 DIG 3134 - Lecture 3: Arrays Michael Moshell University of Central Florida Media Software Design

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 First: Review the HTML Tables while (answers are not yet enough) { foreach (\$class as \$student) if (\$student is here and awake) call on \$student; }
3 Array: A filing cabinet, or a LIST of variables. \$price[1] \$price[2] \$price[3] \$price[4] Variable Name Index Value 1 2 3 (whoops)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 A For-Loop for (\$m=1; \$m<=4; \$m++) { print “now m is “.\$m. “!<br />”; } HAND SIMULATION: value of m: printed output.
5 A For-Loop For (\$m=1; \$m<=4; \$m++) { print “now m is “.\$m. “ !<br />”; } HAND SIMULATION: value of m: printed output.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 A For-Loop For (\$m=1; \$m<=4; \$m++) { print “now m is “.\$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1
7 A For-Loop For (\$m=1; \$m<=4; \$m++) { print “now m is “.\$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1 now m is 1!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 A For-Loop For (\$m=1; \$m<=4; \$m++) { print “now m is “.\$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1 now m is 1! 2
9 A For-Loop For (\$m=1; \$m<=4; \$m++) { print “now m is “.\$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1 now m is 1! 2 now m is 2!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
10 A For-Loop and an array For (\$m=1; \$m<=4; \$m++) { \$list[\$m]= 3; } // that will put 3 in each location of \$m print \$list[2]; //HAND SIMULATE NOW! value of m printed output \$m \$list[\$m] 1 2 3 4
11 A For-Loop and an array: Result after loop finishes For (\$m=1; \$m<=4; \$m++) { \$list[\$m]= 3; } // that will put 3 in each location of \$m print \$list[2]; //HAND SIMULATE NOW! value of m printed output 1 2 3 4 3 \$m \$list[\$m] 1 3 2 3 3 3 4 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A For-Loop and an array For (\$m=1; \$m<=4; \$m++) { \$list[\$m] = \$m; } // that will put \$m in each location of \$m print \$list[2]; // what will this print? value of m printed output \$m \$list[\$m] 1 1 2 2 3 3 4 4
13 A For-Loop and an array For (\$m=1; \$m<=4; \$m++) { \$list[\$m]= \$m; } // that will put \$m in each location of \$m print \$list[2]; // what will this print? value of m printed output 1 2 3 4 2 \$m \$list[\$m] 1 1 2 2 3 3 4 4

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
14 A For-Loop and an array For (\$m=1; \$m<=4; \$m++) { \$list[\$m]= \$m; } // that will put \$m in each location of \$m print \$list[2]; // what will this print? value of m printed output 1 2 3 4 2 \$m \$list[\$m] 1 1 2 2 3 3 4 4
15 A For-Loop and an array For (\$m=1; \$m<=4; \$m++) { \$list[\$m]= 2*\$m; } Print \$list[3]; // what will this print?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
16 A while-Loop and an array (we can go faster now) \$m=1; while (\$m<=7) { \$list[\$m]= 2*\$m; \$m=\$m+2; } Print \$list[5]; // what will this print?
17 A while-Loop and an array \$m=1; While (\$m<=7) { \$list[\$m]= 2*\$m; \$m=\$m+2; } Print \$list[4]; // what will this print?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
18 And now … We move to the subject of STRINGS.
19 The Objective: Learn how to do all kinds of things with text in PHP Why? Numbers are pretty dumb; Almost all good stuff is words.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
20 String Constants & Variables \$n=3; \$test= "A bear came over \$n mountains."; print \$test; // what is printed?
21 String Constants & Variables \$n=3; \$test= "A bear came over \$n mountains."; print \$test; // what is printed?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/25/2011 for the course DIG 3134 taught by Professor Moshell during the Fall '11 term at University of Central Florida.

Page1 / 67

lecture3.arrays - Media Software Design DIG 3134 - Lecture...

This preview shows document pages 1 - 22. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online