Using the code below I need to implement it such that p_poly has only one term of any degree and contains no terms with zero coefficients. I have tried to implement a temporary variable to no avail and was wondering if anyone else had an idea or possibly lead me to a solution.
status read_poly(polynomial * const p_poly)
{
int coef;
int degree;
if (init_list(p_poly) == ERROR) {
return ERROR;
}
do {
printf("\tEnter coefficient, degree (0,0 when done): ");
scanf(" %d,%d", &coef, °ree);
if (coef != 0 && term_insert(p_poly, coef, degree) == ERROR) {
return ERROR;
}}
while (coef != 0 || degree != 0);
return OK;
}