From dfd0add0ccf8b0e33e7bc3b5c349c787db7eac2c Mon Sep 17 00:00:00 2001 From: Nwafor Chibuike Vincent Cletus <97114551+ConquerorCletus@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:14:43 +0100 Subject: [PATCH] Update sign-in.c --- c_programming/log-in/sign-in.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/c_programming/log-in/sign-in.c b/c_programming/log-in/sign-in.c index 75162c7..c0cbfbe 100644 --- a/c_programming/log-in/sign-in.c +++ b/c_programming/log-in/sign-in.c @@ -1,4 +1,5 @@ #include +#include /** * main - Get user signed in. * Return:0 @@ -24,21 +25,17 @@ int main() fgets(passphrase, sizeof(passphrase),stdin); printf("Enter your passphrase again(1):\n"); fgets(pass, sizeof(pass),stdin); - - -/*To make sure pass phrase are the same.*/ for (a = 0; passphrase[a] != '\0' && pass[a] != '\0'; a++) -{ if (passphrase[a] == pass[a]) { printf("Sign-in successful!!\n"); break; } - else if (passphrase[a] != pass[a]) - { - printf("Wrong passphrase!!!\n"); - break; - } - else if (name[a] == '\0')/* || pass[a] =='\0' || userName == '\0' || name == '\0')*/ - { + + /*To make sure pass phrase are the same.*/ + if (strcmp(passphrase, pass) == 0) + printf("Sign-in successful!!\n"); + else if (strcmp(passphrase, pass) != 0) + printf("Wrong passphrase!!!\n"); + + + if (name == '\0' || userName == '\0') printf("Empty field noticed!!!\n"); - } - -} + return (0); }