Advertisement
Guest User

Untitled

a guest
May 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. // PobieranieHasla.cpp
  2. // {P}
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7. #include "conio.h"
  8.  
  9. using namespace std;
  10.  
  11. int _tmain(int argc, _TCHAR* argv[])
  12. {
  13.     string Haslo;
  14.     char d = '*';
  15.     char temp;
  16.     int dlugosc = 0;
  17.  
  18.     for(;;)
  19.     {
  20.         cout << "Podaj Haslo\n:";
  21.         for(int i=0; i<dlugosc; ++i) cout << "*";
  22.         temp = _getch();
  23.         system("CLS");
  24.         if(temp == 13) break;
  25.         if(temp == 8 && dlugosc>0)
  26.         {
  27.             --dlugosc;
  28.             Haslo.resize(Haslo.length()-1);
  29.             continue;
  30.         }
  31.         else if(temp<33 || temp>122)continue;
  32.         Haslo.push_back(temp);
  33.         ++dlugosc;
  34.  
  35.     }
  36.     cout << "Pobrane haslo to : " << Haslo << endl;
  37.     _getch();
  38.    
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement