pass by reference:
1) write a function putInOrder which takes two integers by reference, and puts them in ascending order.
2) write a function putInOrder3 which takes three integers by reference, and puts them in ascending order.
3) Write a function GenerateFullName which takes in three parameters: FirstName, LastName, and FullName. It should generate full names by concatenation of First Name with Last Name. Which should be passed by value, and which by reference?
4) Write a function GenerateFullName2 which takes in two parameters, First Name and Last Name, and *returns* the Full Name.
5) I will demonstrate a trace through a recursive function. Nothing to hand in for this one.
6) Write a recursive function Fib, which will generate the N'th fibonacci number.
See here:
http://en.wikipedia.org/wiki/Fibonacci_number
Wednesday, April 7, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment