This is just because of the default ostream outputprecision.
try like this
Code:
#include <iostream>
#include <iomanip>
using namespace std;


double sqrtOfTwo(int counter) {
    if (counter==0)
        return 0;
    else  {
        counter--;
        return 1.0/(2.0+sqrtOfTwo(counter));
    }
}

int main() {
    cout << setprecision(12) << sqrtOfTwo(10); // doesn't really matter what number comes here
    return 0;
}
Kurt