SabirSazzad

ID Password cheak from file

Feb 23rd, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. //a file name "test.txt", inside file text is "user pass"
  2. #include<iostream>
  3. #include<string>
  4. #include<fstream>
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9. string user, pass;
  10. ifstream readFile("Test.txt", ios::in);
  11. readFile>>user>>pass;
  12.  
  13. string userInput, passInput;
  14.  
  15. while(true){
  16. cout<<"Enter user/pass: \n";
  17. cin>>userInput>>passInput;
  18. if(user.compare(userInput)==0 && pass.compare(passInput)==0)
  19.     {cout<<"Found\n"; break;}
  20. else
  21.     cout<<"Not Found\n";
  22. }
  23.  
  24. cout<<endl;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment