Advertisement
Guest User

Login

a guest
Nov 8th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main () {
  6.  
  7.     int salah = 0, password;
  8.     string username;
  9.  
  10.     string ussr = "Admin";
  11.     int pass = 12345;
  12.  
  13.     /*  Username harus text (string)
  14.         Password harus angka
  15.     */
  16.  
  17.     do {
  18.  
  19.         cout << "Masukkan Username : ";
  20.         cin >> username;
  21.  
  22.         cout << "Masukkan Password : ";
  23.         cin >> password;
  24.  
  25.         if(username == ussr && password == pass) {
  26.  
  27.             cout << "BENAR" << endl;
  28.             break;
  29.  
  30.         } else {
  31.  
  32.             cout << "SALAH" << endl;
  33.  
  34.             salah += 1;
  35.         }
  36.  
  37.     } while(salah < 3);
  38.  
  39.     cout << endl;
  40.  
  41.     if(salah == 3) {
  42.  
  43.         cout << "Username and Password is incorrect. You only had 3x chance to repeat it. " << endl;
  44.     }
  45.  
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement