Guest User

Untitled

a guest
Apr 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.38 KB | None | 0 0
  1.   Ganhadores*insereganhadores(Ganhadores* inicio,char nome)
  2.         {
  3.            Ganhadores* novo = (Ganhadores*) malloc(sizeof(Ganhadores));
  4.            strcpy(novo->nome,nome)
  5.            novo->prox  = NULL;
  6.             if (inicio  == NULL)
  7.             {
  8.                   inicio = novo;
  9.             }
  10.             else
  11.              {
  12.                  Ganhadores* p = inicio;
  13.                  while (p->prox != NULL)
  14.                  {
  15.                     p = p->prox;
  16.                 }
  17.                   p->prox = novo;
  18.             }
  19.               return   inicio  ;  
  20.         }
  21.        
  22.         int VerificarGanhador(Perdedores*lista,char pais)
  23.         {
  24.             int achou=1;
  25.             Perdedores*aux=lista;
  26.             while(aux!=NULL && achou!=0)
  27.             {
  28.                 if(strcmp(lista->nome,pais)==0)
  29.                 {
  30.                     achou=0;
  31.                 }
  32.                 else
  33.                 {
  34.                   aux=aux->prox;
  35.                 }
  36.             }
  37.               ///se nao achou eh porque o pais eh ganhador retorna 1
  38.             return achou;
  39.         }
  40.         do
  41.         {
  42.             gmb=VerificarGanhador(lista_perdedores,aux->nome);
  43.             if(gmb==1)
  44.             {
  45.                 listadeganhadores=insereganhadores(listadeganhadores,aux->nome);
  46.             }
  47.             aux=aux->prox;
  48.         }while(aux!=Lista);
Add Comment
Please, Sign In to add comment