Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct strct_aux
- {
- char nom[150];
- int qt;
- }
- void funcao_extra(EDados *ed)
- {
- if(!ed || !ed->camioes)
- return;
- strct_aux *ax = NULL
- int count = 0,i;
- NOCAM *C = ed->camioes->inicio;
- while(C)
- {
- for(i=0; i<count; i++)
- if(strcmp(C->info->nome,ax[i].nom) == 0)
- {
- ax[i].qt++;
- break;
- }
- if(i == count)
- {
- ax = (strct_ax *)realloc(ax,sizeof(strct_ax) * (count+1));
- strcpy(ax[count].nom,C->info->nome);
- ax[count].qt = 1;
- count++;
- }
- C = C->prox;
- }
- for(i=0; i<count; i++)
- {
- printf("%s ", ax[i].nom);
- while(ax[i].qt > 10)
- {
- printf("[10]");
- ax[i].qt-=10;
- }
- printf("[%d]",ax[i].qt);
- }
- free(ax);
- }
Advertisement
Add Comment
Please, Sign In to add comment