Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- string login(string username, string password)
- {
- string un, pw;
- ifstream read("../../" + username + ".txt");
- getline(read, un);
- getline(read, pw);
- if (un == username && pw == password)
- {
- //cout << "Succesfully logged in!" << endl;
- string result = "success";
- return result;
- }
- else
- {
- //cout << "False login!" << endl;
- string result = "failure";
- return result;
- }
- }
- int main()
- {
- cout << "Please login: " << endl;
- string username, password;
- cout << "Enter username: "; cin >> username;
- cout << "Enter password: "; cin >> password;
- cout << login();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement