Ok, I pretty much give up, I hope to hear from any of you that might be able to help, here is some more fun output..
I edited the while loop again so it gives me even more results, what I have isn't very nice and I don't know, I'm going to make sure the instructor sees what is wrong but if any of you can help, it will be nice. here it is.
Code:
double sine(double x, double precise)
{
double term = 1;
int k = 1;
double sum = 0;
do
{
cout << "k: " << k << endl;
cout << "multiplier: " << power(-1, k+1) << endl;
cout << "power: " << power(x,2*k-1) << endl;
cout << "factorial: " << factorial(2*k-1) << endl;
cout << "fabs: " << fabs(term) << endl;
cout << "term: " << term << endl;
cout << "sum: " << sum << endl;
cout << "sin: " << sin(x) << endl << endl;
term = (power(-1, k+1) * (power(x, 2*k-1)/factorial(2*k-1)));
sum = sum + term;
k= k+1;
}while ((fabs(term)<precise) || (k<10));
return sum;
}
Hi, welcome to the Sine Function
Please enter a angle for the Sine Function
4
To what precision?
.001
Is the value in degrees or radians?
If the value is in degrees, type 'degrees', otherwise you
may type anything else.
no
k: 1
multiplier: 1
power: 4
factorial: 1
fabs: 1
term: 1
sum: 0
sin: -0.756802
k: 2
multiplier: -1
power: 64
factorial: 6
fabs: 4
term: 4
sum: 4
sin: -0.756802
k: 3
multiplier: 1
power: 1024
factorial: 120
fabs: 10.6667
term: -10.6667
sum: -6.66667
sin: -0.756802
k: 4
multiplier: -1
power: 16384
factorial: 5040
fabs: 8.53333
term: 8.53333
sum: 1.86667
sin: -0.756802
k: 5
multiplier: 1
power: 262144
factorial: 362880
fabs: 3.25079
term: -3.25079
sum: -1.38413
sin: -0.756802
k: 6
multiplier: -1
power: 4.1943e+006
factorial: 39916800
fabs: 0.722399
term: 0.722399
sum: -0.661728
sin: -0.756802
k: 7
multiplier: 1
power: 6.71089e+007
factorial: 1932053504
fabs: 0.105076
term: -0.105076
sum: -0.766805
sin: -0.756802
k: 8
multiplier: -1
power: 1.07374e+009
factorial: 2004310016
fabs: 0.0347345
term: 0.0347345
sum: -0.73207
sin: -0.756802
k: 9
multiplier: 1
power: 1.71799e+010
factorial: -288522240
fabs: 0.535716
term: -0.535716
sum: -1.26779
sin: -0.756802
Ok thanks all! night!