next up previous contents
Next: Congregates Up: Local Variables Previous: Local Variables and Parameters   Contents


Homework assignment, 100 points (due in one week)

The program at http://www.drtak.org/teaches/ARC/cisp365/samples/factor.pas works, but it is inefficient. To be more specific, the subroutine find_factor_f_in_n searches for a prime factor from 2 every time.

Start with downloading the program from the link listed above. Similar to the previous homework assignment, you are to add parameters and turn find_factor_f_in_n into a function, however, there is a twist in this homework assignment.

Make the program more efficient by letting find_factor_f_in_n modify a variable, storing the prime factor, that belongs to the main program. To do this, you'll need to perform the following changes to the program:

These are the absolute requirements of the homework assignment. If your program does not conform to all of these requirements, your assignment will receive 0 point.


next up previous contents
Next: Congregates Up: Local Variables Previous: Local Variables and Parameters   Contents
Tak Auyeung 2003-12-03