You are on page 1of 6

#include <stdio.

h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause")
or input loop */
struct infoemploi {
char *Nom;
int NPF;
char indice ;
float indP;
};
struct infoatelier
{
char *NomAF;
char *NomRA;
float Tind ;
int NEF ;
struct infoemploi *emp;

};
float TotalSN;
struct infoatelier *P1;
struct infoemploi *P2;
struct infoatelier *atelier1;

int main(int argc, char *argv[]) {


int NAF=0 ;
TotalSN=0;
printf("veuiller saisir le nombre d atelier:");
scanf ("%d",&NAF);
for (P1=atelier1;P1<atelier1+NAF;P1++){
printf (" nom d atelier %d :",P1-atelier1+1);
scanf("%s",P1->NomAF);
printf (" nom responsable d atelier %d :",P1-atelier1+1);
scanf("%s",P1->NomRA);
printf (" nombre d employes :");
scanf("%d",&(P1->NEF));
P1->Tind=0;
for (P2=P1->emp;P2<P1->emp+(P1->NEF);P2++){
printf (" nom:");
scanf("%s",&(P2->Nom));
printf (" nombre pieces fabriques:");
scanf("%d",&(P2->NPF));
printf (" indice des pieces:");
getchar();
scanf("%c",&(P2->indice));
if(P2->indice=='A')
{
P2->indP=P2->NPF*20;
}
if(P2->indice=='B')
{
P2->indP=P2->NPF*10;
}
if(P2->indice=='C')
{
P2->indP=P2->NPF*5;
}
printf("\n\n\n");
P1->Tind+=P2->indP;
}

TotalSN+=P1->Tind;
printf("\n\n\n");

return 0;
}

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause")
or input loop */
struct infoemploi {
char *Nom;
int NPF;
char indice ;
float indP;
};
struct infoatelier
{
char *NomAF;
char *NomRA;
float Tind ;
int NEF ;
struct infoemploi *emp;

};
float TotalSN;
struct infoatelier *P1;
struct infoemploi *P2;
struct infoatelier *atelier1;
int main() {
int NAF=0 ;
TotalSN=0;
printf("veuiller saisir le nombre d atelier:");
scanf ("%d",&NAF);
for (P1=atelier1;P1<atelier1+NAF;P1++){
printf (" nom d atelier %d :",P1-atelier1+1);
scanf("%s",&(P1->NomAF));
printf (" nom responsable d atelier %d :",P1-atelier1+1);
scanf("%s",&(P1->NomRA));
printf (" nombre d employes :");
scanf("%d",&(P1->NEF));
P1->Tind=0;
for (P2=P1->emp;P2<P1->emp+(P1->NEF);P2++){
printf (" nom:");
scanf("%s",&(P2->Nom));
printf (" nombre pieces fabriques:");
scanf("%d",&(P2->NPF));
printf (" indice des pieces:");
getchar();
scanf("%c",&(P2->indice));
if(P2->indice=='A')
{
P2->indP=P2->NPF*20;
}
if(P2->indice=='B')
{
P2->indP=P2->NPF*10;
}
if(P2->indice=='C')
{
P2->indP=P2->NPF*5;
}
printf("\n\n\n");
P1->Tind+=P2->indP;
}

TotalSN+=P1->Tind;
printf("\n\n\n");

}
printf("\t FICHE DE GESTION DES INDEMENITES DES EMPLOYES DE MOTOPROD \n");
printf("---------------------------------------------------------------------------
\n\n\n");
for (P1=atelier1;P1<atelier1+NAF;P1++){
printf (" nom d atelier %d : %s\t",P1-atelier1+1,P1->NomAF);
printf (" nom responsable d atelier %d :%s \n\n",P1-atelier1+1,P1-
>NomRA);
printf("\t\t\t\tNom\t\tNPF\t\tindiceP\t\tindP\n");
for (P2=P1->emp;P2<P1->emp+(P1->NEF);P2++){
printf("\t\t\t\t%s",P2->Nom);
printf("\t\t%d",P2->NPF);
printf("\t\t%c\t\t",P2->indice);
printf("%.2f",P2->indP);
printf("\n");
}

printf("---------------------------------------------------------------------------
---\n");
printf("\t\t\t\t\t Total indemenites : %.2f DH\n", P1->Tind);
}
printf("\
n------------------------------------------------------------------------------\
n");
printf ("Totaux des indemenites des employes du groupe MOtoprod pendant la journee:
%.2f DH",TotalSN);

return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
char nom[50];
int nbPieces;
char indicePiece;
float indemnites;
} Employe;
typedef struct {
char nom[50];
char responsable[50];
int nbEmployes;
Employe employes[50];
} Atelier;

int main() {
Atelier ateliers[50];
int nbAteliers;
float totalIndemnites;
int taux ,i ,j ;
printf("Veuillez donner le nombre d'ateliers du groupe MOTOPROD :\n");
scanf("%d", &nbAteliers);

for (i = 0; i < nbAteliers; i++) {


printf("Donner le nom de l'atelier numero %d : \t", i+1);
scanf("%s", ateliers[i].nom);

printf("Veuillez saisir le nom du responsable de l'atelier numero %d:\n",


i+1);
scanf("%s", ateliers[i].responsable);

printf("Veuillez saisir le nombre d'employes de l'atelier '%s' :\n",


ateliers[i].nom);
scanf("%d", &ateliers[i].nbEmployes);
for (j = 0; j < ateliers[i].nbEmployes; j++) {
printf("Veuillez saisir le nom de l'employe numero %d de l'atelier
'%s':\n", j+1, ateliers[i].nom);
scanf("%s", ateliers[i].employes[j].nom);

printf("Donner le nombre de pieces fabriquees par l'employe %s qui est


dans l'atelier %s\n", ateliers[i].employes[j].nom, ateliers[i].nom);
scanf("%d", &ateliers[i].employes[j].nbPieces);
getchar();

printf("Entrer l'indice de la piece fabriquee:\n");


scanf("%c", &ateliers[i].employes[j].indicePiece);

switch (ateliers[i].employes[j].indicePiece) {
case 'A':
taux = 20;
break;
case 'B':
taux = 10;
break;
case 'C':
taux = 5;
break;
default:
printf("Erreur dans la saisie de l'indice de la piece\n");

ateliers[i].employes[j].indemnites = ateliers[i].employes[j].nbPieces *
taux;
totalIndemnites += ateliers[i].employes[j].indemnites;
}
}

// AFFICHAGE
printf("\n LA FICHE DE GESTION DES INDEMNITES DES EMPLOYES DE MOTOPROD (PAR
JOURNEE)\n");
for (int i = 0; i < nbAteliers; i++) {

printf("---------------------------------------------------------------------------
--------------------------------------------------------------------\n");
printf("Nom Atelier de Fabrication %d:%s.\t Nom Responsable Atelier %d:%s\
n", i+1, ateliers[i].nom, i+1, ateliers[i].responsable);
printf("Nom\tNPF\tIndiceP\tIndP\n");
for (j =0; j < ateliers[i].nbEmployes; j++) {
printf("%s\t%d\t%c\t%.2f\n", ateliers[i].employes[j].nom,
ateliers[i].employes[j].nbPieces, ateliers[i].employes[j].indicePiece,
ateliers[i].employes[j].indemnites);
}
}

printf("---------------------------------------------------------------------------
---------------------------------------------------\n");
printf("\t\tTotal Indemnites : %.2f\n", totalIndemnites);
printf("\n");

return 0;
}

You might also like