Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cs-142:otheritems [2015/01/07 16:16] (current)
ryancha created
Line 1: Line 1:
 +*Go through example to show them how familyhistory should work
 +<pre>
 +John 6 10 4
 +Zola 2 6 9
 +Frank 3 11 13
 +Fred 10 15 17
 +Sue 9 19 16
 +Mary 7 3 2
 +Beth 4 20 22
  
 +Start with Mary
 +</​pre>​
 +*passing parameters by value, reference, address
 +<pre>
 +void byvalue(int val) {
 + val = 10;
 +}
 +void byaddr(int *val) {
 + *val = 10;
 +}
 +void byreference(int &val) {
 + val = 10;
 +}
 + 
 +int main(){
 +
 + int myval = 5;
 + char *foo = new char [10];
 + cout << "myval is "<<​myval<<​endl;​
 + byvalue(myval);​
 + cout << "after value myval is "<<​myval<<​endl;​
 + myval = 5;
 + byaddr(&​myval);​
 + cout << "myval is "<<​myval<<​endl;​
 + myval = 5;
 + byreference(myval);​
 + cout << "myval is "<<​myval<<​endl;​
 +}
 +</​pre>​
 +*show labyrinth code and talk about call by reference, then have them act it out on a 5x5 grid on the stage
 +<pre>
 +XXXXX
 +X X X
 +X   X
 +X X G
 +XXXXX
 +</​pre>​
 +*Do example where they read in a directory structure and recursively descend it:
 +<pre>
 +ID Name ID ID ID
 +12 Documents 14 19 23
 +14 Pictures 34 33
 +34 pict1.jpg
 +33 pict2.jpg
 +19 school.doc
 +23 work.doc
 +</​pre>​
 +*Exceptions
 +*More Examples
cs-142/otheritems.txt ยท Last modified: 2015/01/07 16:16 by ryancha
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0