34 lines
619 B
C
34 lines
619 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<string.h>
|
|
|
|
int main(int argc, char * argv[]) {
|
|
char real_password[] = "test 1212 34";
|
|
char password[27];
|
|
|
|
printf("Veuillez entrer votre mot de passe : ");
|
|
char c;
|
|
|
|
for (int i = 0; i < 27; i++) {
|
|
if (i < 26) {
|
|
c = getchar();
|
|
password[i] = c;
|
|
|
|
if (c == '\n') {
|
|
password[i] = '\0';
|
|
break;
|
|
}
|
|
} else if (getchar() != '\n') {
|
|
printf("Mot de passe trop long !\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
}
|
|
|
|
if (strcmp(password, real_password) == 0) {
|
|
puts("Authentification réussie.");
|
|
} else puts("Mot de passe incorrect.");
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|