38 lines
622 B
C
38 lines
622 B
C
|
/*
|
||
|
* bapp.c
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include <signal.h>
|
||
|
|
||
|
#define BUFFER_SIZE 20
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
char correctPassword[BUFFER_SIZE];
|
||
|
char suppliedPassword[BUFFER_SIZE];
|
||
|
|
||
|
printf("\nEnter the password now: ");
|
||
|
strncpy(correctPassword, "aaaaabbbbbccccc", BUFFER_SIZE);
|
||
|
gets(suppliedPassword);
|
||
|
printf("\n");
|
||
|
|
||
|
if (strncmp(suppliedPassword, correctPassword, BUFFER_SIZE) == 0)
|
||
|
{
|
||
|
printf("Login successful\n\n");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
printf("Login failure\n\n");
|
||
|
}
|
||
|
|
||
|
printf("suppliedPassword: %s\n", suppliedPassword);
|
||
|
printf("correctPassword: %s\n", correctPassword);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|