/ [R J Botting]
/[CS320 Course Materials]
Tue May 17 08:27:35 PDT 2011
Download, compile and run
[ 11fibo.cpp ]
and trace the activation records as it executes. This
is not your father's Fibbonaci function!
Hint: you can ask for different sequences of Fibonaci numbers
by changing the arguments when you call the compiled program.
If you output the compiled program into 11fibo for example
11fibo 12 14
By the way here
[ fibo.py ]
is a translation into Python (without the tracing and counting).
Download, compile and test
[ 11flipper.cpp ]
which use pass by reference.
Recode it using pass by value of a pointer.
In other words, you may not put & in the header of the function.
You must use '*' and '&' as prefix operators in expressions.
When the program is changed it still does the same thing.
Link the fixed and the original code to your web page.
Note. Call by name is alive and well in C++,
if you have time look at
[ name.cpp ]
for an example of Jensen's device from Algol 60.
Prepare a simple page with links to your lab work today
explaining what you have learned in lab today about C++
functions. Link this page into your index/home/cs320 page.
. . . . . . . . . ( end of section CSci320 Laboratory 10 Functions in C++) <<Contents | End>>
[ ../11.html ]