Skip to content

Commit dfd0add

Browse files
Update sign-in.c
1 parent 2b7bdb5 commit dfd0add

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

c_programming/log-in/sign-in.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdio.h>
2+
#include <string.h>
23
/**
34
* main - Get user signed in.
45
* Return:0
@@ -24,21 +25,17 @@ int main()
2425
fgets(passphrase, sizeof(passphrase),stdin);
2526
printf("Enter your passphrase again(1):\n");
2627
fgets(pass, sizeof(pass),stdin);
27-
28-
29-
/*To make sure pass phrase are the same.*/ for (a = 0; passphrase[a] != '\0' && pass[a] != '\0'; a++)
30-
{ if (passphrase[a] == pass[a]) { printf("Sign-in successful!!\n"); break; }
31-
else if (passphrase[a] != pass[a])
32-
{
33-
printf("Wrong passphrase!!!\n");
34-
break;
35-
}
36-
else if (name[a] == '\0')/* || pass[a] =='\0' || userName == '\0' || name == '\0')*/
37-
{
28+
29+
/*To make sure pass phrase are the same.*/
30+
if (strcmp(passphrase, pass) == 0)
31+
printf("Sign-in successful!!\n");
32+
else if (strcmp(passphrase, pass) != 0)
33+
printf("Wrong passphrase!!!\n");
34+
35+
36+
if (name == '\0' || userName == '\0')
3837
printf("Empty field noticed!!!\n");
39-
}
40-
41-
}
38+
4239

4340
return (0);
4441
}

0 commit comments

Comments
 (0)