I am having trouble with this problem. I have attached the assignment. My main problem is understanding what is being asked of me, I must have no idea. My professor told me I must use a loop because we don't know how many terms to use.

Here is what I have for the function (sorry for the cheesy comments we have too):

Code:

float cosine(float rad, double a)
{
//variable declarations
float cosineofradians;
float t2, t3, t4, t5;
t2 = (pow(rad, 2)/2.0);
t3 = (pow(rad, 4)/24.0);
t4 = (pow(rad, 6)/720.0);
t5 = (pow(rad, 8)/40320.0);
if(-t2<a||t2<a)
{
t2 = 0;
}
if(-t3<a||t3<a)
{
t3 = 0;
}
if(-t4<a||t4<a)
{
t4 = 0;
}
if(-t5<a||t5<a)
{
t5 = 0;
}
//calculating cosine of radians
cosineofradians = 1-t2+t3-t4+t5;
//returning the cos of radians
return cosineofradians;
}