part 4 ok, a test et faire un tri par date

master
parent 57d63ef69a
commit 5a0318b50f

BIN
SAE2

Binary file not shown.

@ -34,6 +34,7 @@ void displayOffre(Offre *o);
void displayListeDevis(ListeDevis l);
void afficherDevisEntreprise(Offre **tabTravaux);
void displayPrecedences(Precedence *tabP, int tlog);
void afficherTaches(Tache **tachesTriees, int p_tmax);
void enfiler(ListeAttente **file, Tache *tache);
void initialiserFileAttente(Tache **tabTache, int nbTaches, ListeAttente **fileAttente);
Offre *newOffre(char *travauxName);

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -100,6 +100,8 @@ Offre **loadOffre(void)
while (!feof(devisFile))
loadDevis(devisFile, tabTravaux);
for (int i = 0; i < TMAXTRAV; i++)
triFusionListeDevis(&tabTravaux[i]->ldevis, lenListeDevis(tabTravaux[i]->ldevis));
return (tabTravaux);
}

@ -8,8 +8,6 @@ int main()
int p_tlog;
tabTravaux = loadOffre();
for (int i = 0; i < TMAXTRAV; i++)
triFusionListeDevis(&tabTravaux[i]->ldevis, lenListeDevis(tabTravaux[i]->ldevis));
minTravaux(tabTravaux);

@ -35,4 +35,6 @@ void traiterTaches(Tache **tabTache, int p_tmax)
exit(1);
}
}
// nouveau tri fusion pour l'ordre des taches
}

@ -212,6 +212,22 @@ int max(int a, int b)
return (b);
}
int calculerDureeProjet(Tache **tachesTriees, int nbTaches)
{
int i;
int dureeProjet;
int finTache;
dureeProjet = 0;
for (i = 0; i < nbTaches; i++)
{
finTache = tachesTriees[i]->dateDebut + tachesTriees[i]->duree;
if (finTache > dureeProjet)
dureeProjet = finTache;
}
return (dureeProjet);
}
/*--------------informations------------*/
// Retourne une liste des successeurs pour un travail donne
@ -239,6 +255,14 @@ Tache* trouverTache(Tache **tabTache, int nbTaches, char *nom)
return (NULL);
}
void listerTachesRestantes(Tache **tachesTriees, int nbTaches, int date)
{
printf("Taches restantes a realiser :\n");
for (int i = 0; i < nbTaches; i++)
if (tachesTriees[i]->dateDebut >= date)
printf("Tache: %s\n", tachesTriees[i]->tache);
}
/*---------------affichages--------------*/
// Affiche les details d'un devis
@ -252,8 +276,9 @@ void displayDevis(Devis d)
void displayOffre(Offre *o)
{
trace("displayOffre");
printf("\n%s\n", o->travaux);
printf("%s\n", o->travaux);
displayListeDevis(o->ldevis);
printf("\n");
}
// Affiche les details de la liste de devis
@ -312,13 +337,22 @@ void afficherDevisEntreprise(Offre **tabTravaux)
void displayPrecedences(Precedence *tabP, int tlog)
{
trace("displayPrecedences");
int i;
printf("Liste des precedences :\n");
for (int i = 0; i < tlog; i++) {
for (i = 0; i < tlog; i++) {
printf("\t%s\t\t : \t%s\n", tabP[i].travauxPrec, tabP[i].travauxSucc);
}
}
void afficherTaches(Tache **tachesTriees, int p_tmax)
{
int i;
printf("Tâches triées par date de début :\n");
for (i = 0; i < p_tmax; i++)
printf("la tache: %s, debute : %d\n", tachesTriees[i]->tache, tachesTriees[i]->dateDebut);
}
// Partie 4 (à trier)

Loading…
Cancel
Save