Merge branch 'master' of https://codefirst.iut.uca.fr/git/sami.ghebrid/SAE_Algo1.02
commit
e984e0b050
@ -1,4 +1,25 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
typedef struct maillonDept
|
||||||
|
{
|
||||||
|
char dept[31];
|
||||||
|
int nbP;
|
||||||
|
char respAd[31];
|
||||||
|
struct mailllonDept *suiv;
|
||||||
|
|
||||||
|
}MaillonDept,*ListeDept;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char nom[31];
|
||||||
|
ListeDept *lDept;
|
||||||
|
|
||||||
|
}VilleIUT;
|
||||||
|
|
||||||
|
int chargement(VilleIUT *tiut[],int *tMax);
|
||||||
|
MaillonDept lireDep(FILE *flot);
|
||||||
|
void afficherDep(MaillonDept m);
|
||||||
|
void globale(void);
|
@ -1,17 +1,52 @@
|
|||||||
#include "Msae.h"
|
#include "Msae.h"
|
||||||
|
|
||||||
|
void clearpage(void)
|
||||||
|
{
|
||||||
|
char entre;
|
||||||
|
printf("\nappuyé sur la touche [ENTREE] pour continuer");
|
||||||
|
scanf("%*c%c", &entre);
|
||||||
|
system("clear");
|
||||||
|
}
|
||||||
|
|
||||||
int login(void)
|
int login(void)
|
||||||
{
|
{
|
||||||
char id,mdp[31]="mettez20svp";
|
int i=3;
|
||||||
|
char id,mdp[31]="mettez20svp",mdpatrouve[31];
|
||||||
|
system("clear");
|
||||||
|
printf("################################################################\n\tBienvenue!\n\n\n\tSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur? (U/A)\t");
|
||||||
|
scanf("%c%*c",&id);
|
||||||
|
if(id=='q')
|
||||||
|
return -1;
|
||||||
while(id!='A' && id!='a' && id!='U' && id!='u')
|
while(id!='A' && id!='a' && id!='U' && id!='u')
|
||||||
{
|
{
|
||||||
printf("################################################################\n\tBienvenue!\n\n\n\tSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur? (U/A)\t");
|
system("clear");
|
||||||
|
printf("################################################################\n\tMauvaise saisie (q pour quitter)\n\n\n\tSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur? (U/A)\t");
|
||||||
scanf("%c%*c",&id);
|
scanf("%c%*c",&id);
|
||||||
if(id=='q')
|
if(id=='q')
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(id=='A' || id=='a')
|
if(id=='A' || id=='a')
|
||||||
return 1;
|
{
|
||||||
|
while(i!=0)
|
||||||
|
{
|
||||||
|
printf("\n\n\n\tMot de passe :\t");
|
||||||
|
system("stty -echo");
|
||||||
|
fgets(mdpatrouve,31,stdin);
|
||||||
|
mdpatrouve[strlen(mdpatrouve)-1] = '\0';
|
||||||
|
if( strcmp(mdpatrouve,mdp) == 0 )
|
||||||
|
{
|
||||||
|
system("stty echo");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
printf("Mot de passe incorrect, il vous reste %d chances\n",i);
|
||||||
|
}
|
||||||
|
system("stty echo");
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
system("clear");
|
system("clear");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue