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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
| #include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <conio.h>
struct Date {
short Jour;
short Mois;
short Annee;
};
struct Ouvriers {
char Genre;
long NumRegistre;
char Nom[25];
char Prenom[30];
char Rue[50];
int CodePostal;
char Ville[20];
char Specialite[20];
struct Date DateNaiss;
struct Date DateEngag;
};
void AfficheOuvri(struct Ouvriers[], int);
int EncodeOuvri(struct Ouvriers[], int);
main ()
{
struct Ouvriers Personne[100];
int nOuvrier = 0;
int nFemme;
int nHomme;
int i = 0;
int Verif;
long NumReg[100];
int Index[100];
char Data[100][56];
nOuvrier = 0;
do{
Verif = EncodeOuvri(Personne, i);
nOuvrier++;
if(Verif == 0)
{
system("cls");
printf("Vous venez de quitter l'inscription des ouvriers.");
Sleep(1000);
}
else
{
if(Verif == 1)
{
system("cls");
printf("-> Ouvrier correctement enregistre.");
Sleep(1000);
}
}
system("cls");
i++;
}while(nOuvrier < 2 & Verif != 0);
}
int EncodeOuvri(struct Ouvriers Personne[], int i)
{
int Verif = 0;
printf("\t\t\tFiche de l'ouvrier %d\n\n", i+1);
printf("- Inscription\n\n");
printf("Genre (M/F): ");
fflush(stdin);
scanf("%c", &Personne->Genre);
if(Personne->Genre != '\n')
{
printf("\nNumero de Registre National: ");
fflush(stdin);
scanf("%ld", &Personne->NumRegistre);
printf("\nNom: ");
fflush(stdin);
scanf("%s", Personne->Nom);
printf("\nPrenom: ");
fflush(stdin);
scanf("%s", Personne->Prenom);
printf("\nRue: ");
fflush(stdin);
scanf("%s", Personne->Rue);
printf("\nCode postal: ");
fflush(stdin);
scanf("%d", &Personne->CodePostal);
printf("\nVille: ");
fflush(stdin);
scanf("%s", Personne->Ville);
printf("\nSpecialite: ");
fflush(stdin);
scanf("%s", Personne->Specialite);
Verif = 1;
}
return Verif;
}
void AfficheOuvri(struct Ouvriers Personne[], int i)
{
printf("\nGenre: %c", Personne->Genre);
printf("\nNumero de Registre: %ld", Personne->NumRegistre);
printf("\nNom: %s", Personne->Nom);
printf("\nPrenom: %s", Personne->Prenom);
printf("\nRue: %s", Personne->Rue);
printf("\nCode postal: %d", Personne->CodePostal);
printf("\nVille: %s", Personne->Ville);
} |
Partager