Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. char Username[30];
  5. char Password[30];
  6.  
  7. void Login()
  8. {
  9.     printf("Username: ");
  10.     scanf("%s", &Username);
  11.  
  12.     printf("Password: ");
  13.     scanf("%s", &Password);
  14. }
  15.  
  16. void checkLogin()
  17. {
  18.     if(strcmp(Username,"admin") == 0 || strcmp(Username,"user") == 0){
  19.         if(strcmp(Password,"pws") == 0){
  20.             printf("You have logged in successfully.\n");
  21.         }else{
  22.             printf("Wrong username or password.");
  23.             exit(1);
  24.         }
  25.     }else{
  26.         printf("Wrong username or password.");
  27.         exit(1);
  28.     }
  29.  
  30. }
  31.  
  32. int main()
  33. {
  34.     Login();
  35.     checkLogin();
  36.  
  37.     /*Start coding bawah ni*/
  38.     printf("Test\n");
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement