Advertisement
Alx09

Topa

Jan 5th, 2022
3,114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {   string pass, passFiser;
  7.     cout << "Introduceti parola: "; cin >> pass;
  8.     ifstream in("pass.txt");
  9.     if(!in){ // daca fiserul nu exista
  10.          cout << "A fost generat fiserul: pass.txt  si s-a introdus parola " << pass;
  11.          ofstream out("pass.txt"); // creem fiserul
  12.          out << pass; // salvam parola
  13.          return 0;
  14.     }
  15.     in >> passFiser; // citim parola din fiser
  16.  
  17.  
  18.     while(pass != passFiser){ // cat timp parola intordusa este diferita de parola citita
  19.             cout <<"Ati introdus parola gresita! "<< endl;
  20.             cout << "Introduceti parola: "; cin >> pass;
  21.     }
  22.     cout<<"Acces permis";
  23.     cin.get();// punem sa astepte in consola
  24.  
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement