I would use a std::set to store 'included' users:
#include <iostream>
#include <fstream>
#include <string>
#include <set>
using namespace std;
int main()
{
set<string> included_user;
string query,user;
cout<< "enter query\n";
getline(cin,query);
cout<< "enter username\n";
getline(cin,user);
{ ifstream newfile( "users.txt");
do
{
string name, comma, inclusion;
newfile >> name >> comma >> inclusion;
if ( inclusion == "include")
included_user.insert(name);
} while (newfile);
}
if (included_user.count(user) > 0)
{
cout << query<<"\n";
}
else
{
cout << "print something\n";
}
}