Solving two nonlinear equations with two unknowns in C++

I have two nonlinear equations with two unknowns, i.e., tau and p. both equations are: p=1-(1-tau).^(n-1) and tau = 2*(1-2*p) ./ ( (1-2*p)*(W+1)+(p*W).*(1-(2*p).^m)).

I am interested to find the value of tau. How I can find this value using c++ code, I have done that using MATLAB and here is the code that I used:

function result=tau_eq(tau)

n=6;
W=32;
m=5;

p=1-(1-tau).^(n-1);
result=tau - 2*(1-2*p) ./ ( (1-2*p)*(W+1)+(p*W).*(1-(2*p).^m));

Statement at the command window:
result=fzero(@tau_eq,[0,1],[])

Can some one help me in that since I am new to C++. Thanks in advance
Hiya,
If you've done it in matlab i'm assuming you're familiar with the maths and the corresponding algorithms? If that's the case can i suggest you go through the tutorials on this site, especially control flow:
http://www.cplusplus.com/doc/tutorial/control/
Topic archived. No new replies allowed.