APL/APL1.1/TP14/lecture.c

25 lines
519 B
C
Raw Normal View History

2021-10-12 16:14:21 +02:00
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char * argv[]) {
char real_password[] = "test 1212 34";
char password[27];
for (int i = 1; i < argc; i++) {
if (i != 1) strcat(password, " ");
if (strlen(password) + strlen(argv[i]) > 26) {
puts("Mot de passe trop long !");
return EXIT_FAILURE;
}
strcat(password, argv[i]);
}
if (strcmp(password, real_password)) {
puts("Authentification réussie.");
} else puts("Mot de passe incorrect.");
return EXIT_SUCCESS;
}