What I am trying to do is compare the contents of array s to the string name (for a filter) but it just continues and prints whatever goes through. I think the problem is with my if statement but I have tried everything that I thought was valid code.
#include <iostream>
#include <string>
using namespace std;
void check(string name)
{
string s[4];
s[0]=="badword1";
s[1]=="badword2";
s[2]=="badword3";
s[3]=="badword4";
if(name==s[0-4])
{
string name="******";
}
}
string name;
int main()
{
int x;
x=0;
for(x=0; x<1;)
{
cout<<"hello whats your name: ";
getline(cin,name);
check(name);
cout<<name;
cout<<endl;
}