Guest User

login

a guest
Nov 10th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int main(){
  5.    char username[6]= "fantio", pass[9]= "fantio123";
  6.    char usr[6], pas[9];
  7.    int status = 0, salah = 0;
  8.  
  9.    while(status < 3){
  10.       printf("------------- LOGIN ---------------\n");
  11.       printf("Masukkan Username : ");
  12.       gets(usr);
  13.       printf("Masukkan Password : ");
  14.       gets(pas);
  15.  
  16.       if(strcmp(username, "fantio")==0 && strcmp (pass, "fantio123")== 0){
  17.          printf("Akses diterima. Selamat Datang\n");
  18.          break;
  19.       }else{
  20.          printf("Maaf, username atau Password anda salah\n");
  21.          salah++;
  22.          if(salah == 3){
  23.             printf("Akses ditolak\n");
  24.          }
  25.       }
  26.       status++;
  27.    }
  28.       printf ("Anda telah 3x memasukan Username & Password yang salah.\n");
  29.       printf ("Mohon maaf akun anda kami blokir untuk sementara. \n");
  30.    system("pause");
  31.    return 0;
  32. }
Add Comment
Please, Sign In to add comment