nod * mul ( nod * prim1, nod * prim2 ) { nod * prim=NULL; while ( prim2 ) { nod * aux=NULL, * aux1; aux=mulmonom ( prim1, prim2->coeficient, prim2->grad ); aux1=prim; prim=adunare ( prim, aux ); sterg ( aux ); sterg ( aux1 ); prim2=prim2->adr; } return prim; }
void divp ( nod * deim, nod * imp, nod *& cat, nod *& rest ) { float coef; unsigned gradul; cat=rest=NULL; while ( deim ) { adaug1 ( rest, deim->coeficient, deim->grad ); deim=deim->adr; } while ( rest->grad>=imp->grad ) { coef=rest->coeficient/imp->coeficient; gradul=rest->grad-imp->grad; adaug1 ( cat, coef, gradul ); nod * factor=NULL; adaug1 ( factor, coef, gradul ); nod * pol=mul ( imp, factor ); sterg ( factor ); nod * neg=negativ ( pol ); sterg ( pol ); rest=adunare ( rest, neg ); sterg ( neg ); } }
void reply_c(int sockfd, char *sir){ t_char bl; sockfdex = sockfd; bz = gdbm_open("baza.db", 512, GDBM_WRCREAT, 0600, 0); if(is_command(sir, &bl)){ switch (bl.c) { case 'I' : sterg();break; case 'i' : inserare(bl.cv, bl.ex);break; case 's' : stergc(bl.cv, bl.ex);break; case 'c' : exista(bl.cv);break; case 'e' : explic(bl.cv, bl.ex);break; case 'l' : afisez(); case 'q' : break; default : smsg("\nInvalid command\n"); } } else smsg("\nInvalid command\n"); gdbm_close(bz); }