Q: Any possible to add more than one name into a variable c++ i am trying to make a login system that uses the user from the PC. The problem is that i want to add more than one user. Thanks in advance.
THIS CODE ACTUALLY WORKS!!
using namespace std;
string user = "LaCk";

int main()
{
    SetConsoleTitle("checking whitelist...");
    std::cout << "checking whitelist...\n";

    TCHAR username[UNLEN + 1];
    DWORD usernamel_len = UNLEN + 1;

    GetUserName((TCHAR*)username, &usernamel_len);

    if (username == user)
    {
        SetConsoleTitle("Welcome");
        std::cout << "Welcome back "; wcout << username << endl;
        Sleep(500);
    }
    else
    {
        SetConsoleTitle("YOU ARENT IN THE WHITELIST");
        Sleep(15000);
    }

}


A: Change your user variable from a single std::string to a std::vector of std::string elements.  Then you can store multiple strings, and can use std::find() to search it.
Also, you don't need the (TCHAR*) type-cast, since your username array will decay into a TCHAR* for you.  However, you should be using GetUserNameA() instead, since you are dealing with char data.  Don't use TCHAR at all in modern coding.
Try this:
#include <vector>
#include <string>
#include <algorithm>

std::vector<std::string> users;

void loadUsers()
{
    users.push_back("LaCk");
}

std::string getCurrentUser()
{
    std::string res;

    char username[UNLEN + 1];
    DWORD usernamel_len = UNLEN + 1;

    if (GetUserNameA(username, &usernamel_len))
        res.assign(username, usernamel_len-1);

    return res;
}

int main()
{
    loadUsers();

    SetConsoleTitle("checking whitelist...");
    std::cout << "checking whitelist...\n";

    std::string username = getCurrentUser();

    if (std::find(users.begin(), users.end(), username) != users.end())
    {
        SetConsoleTitle("Welcome");
        std::cout << "Welcome back " << username << std::endl;
        Sleep(500);
    }
    else
    {
        SetConsoleTitle("YOU ARENT IN THE WHITELIST");
        std::cout << "Sorry " << username << ", access denied!" << std::endl;
        Sleep(15000);
    }

    return 0;
}

