Advertisement
le_lukasz

Untitled

Apr 27th, 2021
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string login, login_baza="Robik";
  8.     string haslo, haslo_baza="Gwi@zdA#99";
  9.     bool poprawne_logowanie = false;
  10.     int nieudane_proby =0;
  11.  
  12.  
  13.     do
  14.     {
  15.         cout << "Login: ";
  16.         cin >> login;
  17.  
  18.         cout << "Hasło: ";
  19.         cin >> haslo;
  20.         cout << endl;
  21.  
  22.         if(login == login_baza && haslo == haslo_baza)
  23.         {
  24.             cout << "Logowanie prawidłowe" << endl;
  25.             poprawne_logowanie =true;
  26.         }
  27.         else
  28.         {
  29.             cout << "Błąd logowania" << endl;
  30.             poprawne_logowanie = false;
  31.             nieudane_proby++;
  32.         }
  33.     }
  34.     while(!poprawne_logowanie && nieudane_proby < 3 );
  35.  
  36.     if(nieudane_proby == 3)
  37.     {
  38.         cout << "Trzykrotnie podałeś złe dane!"<<endl;
  39.         cout << "Koniec prób." <<endl;
  40.     }
  41.  
  42.     return 0;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement