help stuck!

Did this real quick there is an error, because no matter what password i enter it always says that its a common password!?  Can anyone see the error?? thanks!

/*This is in c++ by the way, the text file is in this link ( i saved it as a .txt file 

Write a program to detect common passwords.

Read in the given file into an array of string objects (allow for 4000 entries).

Then read passwords from a user and call a function (that you write) to return whether the password is common or not.


using namespace std;

bool search(string commonPasswords[],string userPass,int count);

int main(){

const int MAX = 4000;
string commonPasswords[MAX];
int i = 0;
int count = 0;
string userPass;
bool found = false;
count = i;

//make cin equivalent to take in data file
ifstream infile;

//open the file“C:\\Users\\brian\\Desktop\\passwordsUpdated.txt”);

//check if file exists
cout<<“your file doesn’t exist! “;
return 1;

//read in file using a while loop with an eof marker

count = i;

//read in password from user
cout<<“Enter a password please…\n”;

//function call
found = search(commonPasswords,userPass, count);
cout<<“Your password is too common, try again! \n”;
cout<<“Good password! \n”; 

return 0;


bool search(string commonPasswords[], string userPass, int count){

int j = 0;
for(j=0; j<count; j++){
if(userPass == commonPasswords[j])
return true;
return false;



One thought on “help stuck!

  1. won says:

    It was the (!found), which should have been just found oops!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: