Well it is good that your school is teaching you these things because in the industry you sometimes have to rebuild some basic functions from scratch because you will have to add some sort of business twist.
Now the way you have setup the squareroot function is going to be a little more troublesome because you have done (according to mathforum.org) steps 2, 3 and 2 again. Your function should just do steps 2 and 3. Right now as you got it the result of your first squareroot iteration for 12 and a guess of 2 would return 3 which is not right. The answer is 4 (the result of step 3 not the result of step 2).
So if you do just steps 2 and 3 in the function your loop will look like this (in pseudocode)
CODE
Collect number and guess from user
Start for loop from 1 to number of iterations (n)
Call squareroot function and pass in number and guess
Store result as the square root
Set new guess to the calculated square root
Loop
So hopefully this makes sense. Your function should only be doing steps 2 and 3 to get the square root. Use that answer for additional calls to squareroot for as many times as you wanted.
Enjoy!
"At DIC we be squared code ninjas because everyone else is the square root of us!"
This post has been edited by Martyr2: 11 Apr, 2008 - 11:25 AM