SAE11_2024/DEV1.1/TP15/lecture.c

29 lines
509 B
C
Raw Permalink Normal View History

2024-10-07 17:30:04 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int i=0;
int nb_juste=0;
char mdp_secret[26] = {'J','s','a','i','s','p','a','s','\0'};
char mot_de_passe[26];
while(i<26){
mot_de_passe[i]= getchar();
if (mot_de_passe[i]==mdp_secret[i]){
nb_juste++;
}
if(mot_de_passe[i]==13){
break;
}
i++;
if (nb_juste==1){
printf("Accès accordé\n");
break;
}
else {
printf("Accès refusé\n");
break;
}
}
}