//multiplication.c
#include <stdio.h>
#include <stdlib.h>
#include "struc.h"

void multiplication  (ptr_liste L1, ptr_liste L2, ptr_liste *Lo)
{
    ptr_liste newstruct;//temporaire pour une nouvelle structure
    ptr_liste temp;//temporaire de Lo
    ptr_liste tempL1=NULL;//temporaire de la liste chainé L1
    ptr_liste tempL2=NULL;//temporaire de la liste chainé L2
    ptr_liste L3=NULL;
    ptr_liste L4=NULL;

       //On vérifie si l'une des deux listes est Null
      if (L1==NULL)
       {
          *Lo=L2;
       }
       else if (L2==NULL)
       {
           *Lo=L1;
       }
       else
       {
       tempL1=L1;
       tempL2=L2;

                 while (tempL1!=NULL)
                 {
                   if (L3!=NULL && L4!=NULL)
                   {
                      addition_pol(L3,L4,&Lo);
                      //on copie
                   }
                   //else if (L3!=NULL)

                   //}

                       while (tempL2!=NULL);
                       {
                             newstruct=(ptr_liste)malloc(sizeof(list));
                             newstruct->suivant=NULL;
                             newstruct->exp=(tempL1->exp) + (tempL2->exp);
                             newstruct->coef=(tempL1->coef)*(tempL2->coef);


                              if (L4==NULL)
                              {
                              L4=newstruct;
                              temp=L4;
                              }
                              else
                              {
                                temp->suivant=newstruct;
                                temp=temp->suivant;
                              }
                              tempL2=tempL2->suivant;
                       }
                       tempL1=tempL1->suivant;
                 }


       }


}
