can somebody please help me with this problem?

Given the function f(x) : 2tanx-x-1=0, write a program that will compute the value for x using trial and error.

Let me explain again, the user inputs a value for x and substitutes it in the formula above. The left side of the equation should equal to 0 once it's computed. If the x entered does not satisfy the equation, then the program should output the correct value for x. My problem is, I can't figure out how to do the tangent in the formula and I can't even find out what x should be.

I'm thinking of placing my code here but I think it's useless anyway cos it's all wrong. I'm using MS Visual C++ to write the code. please help... >_<

wait! i'm not asking you to write the whole program for me but i just want to know how to calculate formulas with tangents in it like the one above. thank you!