Help with Stack Overflow Problem!
<p>First, I would like to say this is my first attempt at doing a recursive function for my programming class! Anyways, the assignment is to find the root of any positive integer using recursion (absolutely no iteration). My code correctly evaluates the square root of any positive number, but when I try to take say the fourth root or third root of a number I get a stack overflow error.  I will post my code and any help would greatly be appreciated. Blast away if you feel need hah.</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;iomanip&gt;
#include&lt;cstdlib&gt;
using namespace std; 

double squareRoot (int root, double number, double low, double high); 

int main() {
    int root = 0; 
    double number; 
    double low, high; 
    double guess = 0;
    double error = 0; 
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint); 

    do
    {
        cout &lt;&lt; "Find what root? (0 ends): "; 
        cin &gt;&gt; root; 
        if (root == 0)
        {
            exit(1); 
        }
        else
        {
            cout &lt;&lt; "Root of what value? "; 
            cin &gt;&gt; number;
        }
        low = number - (number - 1);  
        high = number;
        cout &lt;&lt; "root " &lt;&lt; root &lt;&lt; " of " &lt;&lt; setprecision(4) &lt;&lt; number &lt;&lt; " is " &lt;&lt; setprecision(10) &lt;&lt; squareRoot (root, number, low, high) &lt;&lt; endl; 
    }while (root != 0);  

    cin.get(); 
    cin.get(); 
    return 0; 
}

double squareRoot (int root, double number, double low, double high)
{
    cout.setf(ios::fixed); 
    cout.setf(ios::showpoint); 
    cout.precision(10); 
    double guess = (high + low) / double(root); 
    double error = abs(number - (guess * guess));  
    if ((guess * guess) == number || error &lt;= 0.000000000001)
    {   
        return guess; 
    }
    else if ((guess * guess) &gt; number)
    {
        high = guess;  
        return squareRoot(root, number, low, high); 
    }
    else
    {
        low = guess; 
        return squareRoot(root, number, low, high); 
    }
}
</code></pre>
