1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
//DECLARATION DES TYPES DE STRUCTURES
typedef struct piste
{
int code_piste, nb_empl;
char designation[20], statut[20], type_vol[20];
}piste;
typedef struct employe
{
int code_employe, code_piste,nb_empl;
char nom[15], prenom[15], tel[11], fonction[20];
piste element;
}employe;
//DECLARATIONS GENERALES
//TABLEAUX
piste tab_piste[100];
employe tab_employe[100];
//TYPES
piste tempiste;
employe tempemploye;
//ENTIERS
int i, j, k, code, rstS, rstT, rstF;
int choix, choix_p, choix_m, choix_s, choix_e, choix_d;
int nb_piste, nb_employe;
//BOOLEEN
int trouve; // 0=FALSE & 1=TRUE
//REELS
float calc, moy;
float nbp,nbe;
case 4: // NOMBRE D'EMPLOYE PAR STATUT
{
//COMPTER LE NOIMBRE D'EMPLOYES PAR PISTE
system("cls");
for(i=0;i<nb_piste;i++)
{
tab_piste[i].nb_empl=0;
for(j=0;j<nb_employe;j++)
{
if(tab_piste[i].code_piste==tab_employe[j].code_piste) tab_piste[i].nb_empl++;
}
}
// TRIER LES EMPLOYES PAR PISTES
for(j=0;j<nb_piste-1;j++)
{
for(k=j+1;k<nb_piste;k++)
{
if(tab_piste[j].nb_empl<tab_piste[k].nb_empl)
{
tempiste=tab_piste[j]; tab_piste[j]=tab_piste[k];
tab_piste[k]=tempiste;
}
}
}
// ANALYSER LES STATUTS
rstS=nb_piste;
for(i=0;i<nb_piste;i++)
{
for(j=i+1;j<rstS;j++)
{
if(strcmp(tab_piste[i].statut,tab_piste[j].statut)==0)
{ tab_piste[i].nb_empl=tab_piste[i].nb_empl+tab_piste[j].nb_empl;
tempiste=tab_piste[j];
tab_piste[j]=tab_piste[nb_piste];
tab_piste[nb_piste]=tempiste;
rstS--;
}
}
}
printf("Il y a donc:\n");
for(i=0;i<rstS;i++)
{
printf("\nStatut:%s\n",tab_piste[i].statut);
printf("Nombre d'employes:%d\n",tab_piste[i].nb_empl);
}system("pause");
}break; |
Partager