Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //a file name "test.txt", inside file text is "user pass"
- #include<iostream>
- #include<string>
- #include<fstream>
- using namespace std;
- int main(){
- string user, pass;
- ifstream readFile("Test.txt", ios::in);
- readFile>>user>>pass;
- string userInput, passInput;
- while(true){
- cout<<"Enter user/pass: \n";
- cin>>userInput>>passInput;
- if(user.compare(userInput)==0 && pass.compare(passInput)==0)
- {cout<<"Found\n"; break;}
- else
- cout<<"Not Found\n";
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment