• Go through example to show them how familyhistory should work
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
  • passing parameters by value, reference, address
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;
}
  • show labyrinth code and talk about call by reference, then have them act it out on a 5×5 grid on the stage
XXXXX
X X X
X   X
X X G
XXXXX
  • Do example where they read in a directory structure and recursively descend it:
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
  • Exceptions
  • More Examples
cs-142/otheritems.txt · Last modified: 2015/01/07 09: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