Your code shown is incomplete.
But that is beside the point...
Your homework is given to help you to learn.
If we give you a solution you will not have the "think through" solving the problem.
I'll give you a HINT:
type
double
will give more precision than
float
EDIT:
Since you imply this is not for a c++ programming course, but that you were expected to have some programming background, here is the iteration part of the program.
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float u,v, prevu;
u=2;
v=1/sqrt(2);
prevu = 0;
while (fabs(prevu - u) > 10e-6f)
{
prevu = u;
u = u/v;
v = sqrt((1 + v)/2);
}
}
My c++ I/O is very rusty, sorry.