Beginner user registration and login program
Not a full review, but too long for a comment

I'm not a C++ developer, but there are a few common foundational programming mistakes that you've made that I saw:


using namespace std is a bad practice. This imports the entirety of the namespace into the current namespace, which can cause a multitude of problems. Here is an article that explains the possible problems, going more in-depth than I could ever. *Note: I didn't change anything that would require std:: at the beginning by removing the namespace, merely for the fact that I don't have the time right now. That can be a good exercise for you :).
Instead of return true; } else { return false; }, simply return the expression you're evaluating. For example in your code, return (un == user &amp;&amp; pw == pass).
When a user enters an already existing username/incorrect username or password/username not registered, you call main() again. This can fill the stack pretty quickly with these recursive calls. What if a user keeps making mistakes? Then you have tens or even hundreds of main calls in the stack. Not good. You can wrap all the code in main in a while loop. If a user makes a mistake, simply do nothing and let the loop reset. If a user makes a valid choice, do what you need to do, then break. Note: Didn't implement this either because of time, this one is for you :).


Barely changed but still changed code

#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

//ADD "std::" TO ALL THINGS THAT COME FROM STD NAMESPACE

bool IsLoggedIn()
{
    string user, pass, un, pw;
    cout &lt;&lt; "Username: " &lt;&lt; std::endl;
    cin &gt;&gt; user;
    cout &lt;&lt; "Password: " &lt;&lt; endl;
    cin &gt;&gt; pass;

    ifstream read(user + ".txt");
    getline(read, un);
    getline(read, pw);

    return (un == user &amp;&amp; pw == pass);

}

inline bool does_file_exist(const string&amp; name)
{
    ifstream filename(name +".txt");

    return filename;

}

int main()
{
    system("clear");

    int input;
    cout &lt;&lt; "(1) Create Account \n" &lt;&lt; "(2) Log in \n"&lt;&lt; "(3) Change password" &lt;&lt; endl;
    cin &gt;&gt; input;
    if (input == 1 || input == 2 || input == 3)
    {
        if (input == 1)
        {
            system("clear");

            string user, pass;

            cout &lt;&lt; "Create Account \n" &lt;&lt; endl;
            cout &lt;&lt; "Username: " &lt;&lt; endl;
            cin &gt;&gt; user;

            if (does_file_exist(user))
            {
                cout &lt;&lt; "Username already registered \n" &lt;&lt; "Press enter to retry...";
                cin.ignore();
                cin.get();
                main();
            }

            cout &lt;&lt; "Password: " &lt;&lt; endl;
            cin &gt;&gt; pass;

            ofstream file;
            file.open(user + ".txt");
            file &lt;&lt; user &lt;&lt; endl &lt;&lt; pass;
            file.close();

            main();
        }

        else if (input == 2)
        {
            system("clear");

            cout &lt;&lt; "Log In \n" &lt;&lt; endl;

            bool status = IsLoggedIn();

            if (!status)
            {
                cout &lt;&lt; "Incorrect username or password!" &lt;&lt; endl &lt;&lt; "Press enter to retry...";
                cin.ignore();
                cin.get();
                main();
                return 0;
            }
            else
            {
                cout &lt;&lt; "Successfully logged in!" &lt;&lt; endl;
                cin.get();
                return 1;
            }

        }

        else if (input == 3)
        {
            system("clear");

            string user, pass;

            cout &lt;&lt; "Change password \n" &lt;&lt; endl;
            cout &lt;&lt; "Username: " &lt;&lt; endl;
            cin &gt;&gt; user;
            if (does_file_exist(user))
            {
                cout &lt;&lt; "New Password: " &lt;&lt; endl;
                cin &gt;&gt; pass;

                ofstream file;
                file.open(user + ".txt");
                file &lt;&lt; user &lt;&lt; endl &lt;&lt; pass;
                file.close();

            main();
            }
            else
            {
                cout &lt;&lt; "Username not registered \n" &lt;&lt; "Press enter to retry...";
                cin.ignore();
                cin.get();
                main();
            }

        }
    }
    else
    {
        system("clear");
        cout &lt;&lt; "Invalid input" &lt;&lt; endl;
        main();
    }
}