File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change 1
1
#include <stdio.h>
2
+ #include <string.h>
2
3
/**
3
4
* main - Get user signed in.
4
5
* Return:0
@@ -24,21 +25,17 @@ int main()
24
25
fgets (passphrase , sizeof (passphrase ),stdin );
25
26
printf ("Enter your passphrase again(1):\n" );
26
27
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' )
38
37
printf ("Empty field noticed!!!\n" );
39
- }
40
-
41
- }
38
+
42
39
43
40
return (0 );
44
41
}
You can’t perform that action at this time.
0 commit comments