#include <stdio.h>
#include <stdlib.h>
#define USER "user"
#define PASSWORD "1234"
char login[16] = USER;
char password[16] = PASSWORD;
int Login()
{
char loginFromInput[16];
char passwordFromInput[16];
int i;
for (i=0; i<3; i++)
{
printf("Please type your username: \n");
scanf("%s", &loginFromInput);
printf("Please type your password: \n");
scanf("%s", &passwordFromInput);
if(CheckForPassword(loginFromInput, passwordFromInput))
{
printf("Login successful");
return 1;
}
printf("Wrong password.Try Again \n");
}
printf("Sorry, your account is locked, contact the system administrator");
return 0;
}
int CheckForPassword(char * loginInput, char * passwordInput)
{
if (!strcmp(login, loginInput) && !strcmp(password, passwordInput))
return 1;
else
return 0;
}
int main()
{
Login();
return 0;
}