I'm doing a simple program that is finding the username and password in a text file. Originally when i wrote the program it ran fine, however, now I am getting "String subscript out of range errors" and I am not really sure why. Any help I could get would be great.
Here is my code:
string username, password, pwCheck;
ifstream adminIn; 
adminIn.open("admin.txt");
cout << "\n\nAdmin and Librarian Login\n\n";
cout << "Username:  ";
cin >> username;
cout << "Password:  ";
cin >> password;
bool isFound = false;
while (!adminIn.eof())
{
    string temp = "";
    for (int i = 0; i < username.size(); i++)
    {
        if (temp[i] == username[i])
        {
            isFound = true;
        }
        else
        {
            isFound = false;
        }
    }
    if (isFound)
    {
        for (int i = username.size() + 1; i < temp.size(); i++)
        {
            pwCheck = pwCheck + temp[i];
        }
    }
}
 
     
    