Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Fun鈬o que devolve o n伹ero de camis sem motorista
- int NumCamSemMot(ptGES gestor)
- {
- if (!gestor || !gestor->Camioes || !gestor->Motoristas)
- return 0;
- gestor->Historico = fopen("Historico.csv", "a");
- fprintf(gestor->Historico, "%s;%s\n", __FUNCTION__, __DATE__);
- fclose(gestor->Historico);
- NOCAM * C = gestor->Camioes->prim;
- NOAFE *A;
- int count = 0;
- int auxid;
- while (C)
- {
- auxid=-1;
- A = gestor->Afetacao->ult;
- while (A)
- {
- if(auxid == -1)
- {
- if (C->info->id == A->info->id_cam)
- {
- auxid = A->info->id;
- A=A->seg;
- continue;
- }
- A = A->ant;
- }
- else
- {
- if(auxid == A->info->id)
- break;
- A=A->seg;
- }
- }
- if(!A) //Se o aux id for -1 quer dizer que nao encontrou o camiao.
- count++;
- C = C->seg;
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement