Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <iostream>
  2. #include <conio.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int i;
  7. char ch;
  8. cout << "============================\n";
  9. cout << "Selamat Datang di Form Login \n";
  10. cout << "============================\n";
  11.     for (i=1; i<=3; i++) {
  12.        string user = "";
  13.        string pass = "";
  14.        cout << "Username : "; cin >> user;
  15.        cout << "Password : ";
  16.             ch = _getch();
  17.             while(ch != 13){//character 13 is enter
  18.             pass.push_back(ch);
  19.             cout << '*';
  20.             ch = _getch();
  21.             }
  22.  
  23.        if (user == "ifannuddin" && pass == "12345") {
  24.          cout << "\n\nAnda berhasil login. \n" << endl;
  25.          return 0;
  26.       } else {
  27.          cout << "\n\nMaaf Username & Password anda masukan salah.\n\n";
  28.       }
  29.    }
  30.    while (i <= 3);
  31.  
  32.    cout << "Anda telah 3x memasukan Username & Password yang salah.\n";
  33.    cout << "Mohon maaf akun anda kami blokir untuk sementara. \n";
  34.    cout << "Silahkan hubungi kami melalui e-mail support@email.com, Terima Kasih..";
  35.    getch();
  36. }