#include <stdio.h>
#define max_pasw 5
#define lung_pasw 6
void fine(void);
int main(void)
{
char psw_note[max_pasw][lung_pasw] = {"primaa",
"second",
"terzaa",
"quarta",
"quinta"};
char password[lung_pasw];
int i, j;
int ok;
int accesso = 0;
printf("\n\tQUESTO E' UN SISTEMA AD\n\tACCESSO CONTROLLATO\n\n");
printf("Inserire login: [esattamente %d caratteri]: ", lung_pasw);
for (i = 0; i < lung_pasw; i++)
password[i] = getchar();
getchar();
for (i = 0; i < max_pasw; i++) {
ok = 0;
for (j = 0; j < lung_pasw; j++)
if (password[j] == psw_note[i][j])
ok++;
if (ok == lung_pasw) accesso = 1;
}
if (accesso)
printf("Login CORRETTA\n");
else
printf("Login NON CORRETTA\n");
fine();
return 0;
}
void fine(void)
{
printf("\ninvio per finire\n");
while (getchar() != '\n');
}