Click Here

Here's the formula to compute sinx and cosx in C++.

here is the code I wrote at first to calculate it:

http://codepad.org/cbdGB8wL and it gives me good results.

The problem is my lecturer would prefer me to use the formula as attached , but I get stucked, how can I code the formula above?

here's the code that I think should work but it don't:

http://codepad.org/A6uDX4GP

Please note that you can only enter (0 to 2pi radian) since this is just part of the program and I'm testing on it.

ie, input 1.570796326794897 which is 90 degree should produce 1 but the modified code there gives me wrong values...

Can someone guides me to fix the problem here, I keep thinking and the logic should work there, I couldn't figure out why...? Thanks for your help, I appreciate that!