这是我的功能和结构,不起作用的是
精确点void Derivee
的导数和值,
float Valeur
。我当然会处理列表。
get_at(polyliste* p, int index ,float* coeff,int* deg)
typedef struct node* Node;
typedef struct node
{
float coeff;
int degree;
Node next;
} node;
typedef struct
{
Node head;
} polyliste;
polyliste create()
{
polyliste p;
p.head = NULL;
return p;
}
float Valeur(polyliste p, float x)
{
float s = 0, coeff;
int i = 0, degree;
while (get_at(&p, i, &coeff, °ree) == 0)
{
s = s + (coeff * power(x, degree));
i++;
}
printf("\nLe resultat est : %f", s);
return s;
}
void Derivee(polyliste *p, polyliste *s)
{
int i = 0, degree;
float coeff;
*s = create();
while (get_at(&p, i, &coeff, °ree) == 0)
{
if ((coeff != 0) && (degree != 0))
{
coeff *= degree;
degree--;
add_first(s, degree, coeff);
}
i++;
}
}