void password(){
        string fpass;
    string pass;
    cout << "Type the password " << endl;
    ifstream fin(FILENAME1);
    string str;
    getline(fin, str);
    fpass = str;
    if (pass.compare(fpass) == 0){
        cout << "    Hello!" << endl << endl;
        cout << "What do you want to do?" << endl;
        cout << "\n\n INCORRECT! \n \n \n";
        char choice;
        cout << "Try again? y/n -->   ";
        cin >> choice;
        if (choice == 'y'){

What's the problem with this? It worked, but didn't do what I expected...

Debug your code.

Output the value of pass and fpass at the start, and each time you think they should (or may) have changed.

Thanks, it's working now! When I typed the correct password, the program stopped. But the problem was the "fpass = str". I changed it to "fpass == str", and now it's working perfectly.