HELP with assignment about password requirements !!!

These are the requirements for the user input password that I have to add to my current codes:

1.The password must be at least 8 characters long.
2.The password must contain at least: one alpha character [a-zA-Z];
3.At least one capital letter
4.and at least one numeric character [0-9];
5.one special character from this set: ! $ % ?
6.no spaces (use getline)

below is my original codes before adding the requirements:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

bool search(string, string[], int);

int main(){

	const int mPassword = 4000;
	string cPasswords[mPassword];
	string uPassword;
	bool found = false;
	int count;
	int i=0;

	ifstream ifs("passwords.txt");
	if(!ifs.is_open()){
		cout<<"Error on openning file";
	}
		while(!ifs.eof())
		{
			ifs>>cPasswords[i];
			i++;
			
		}
		count = i;
		cout<<"Input User Password..."<<endl;
		for(;;)
		{
			cin>>uPassword;
			found = search(uPassword, cPasswords, count);
			if(found)
				cout<<"Too Common, please try another one"<<endl<<endl;
			else
				cout<<"Good Password!"<<endl<<endl;
		}

	system("pause");
	return 0;
}

bool search(string a, string b[], int c)
{
	for(int i=0;i<c;i++)
	{
		if(a==b[i])
			return true;
	}

	return false;

}



The thing is i have no idea where to start since im new to C++, any suggestion ?
no one ?
you will need to choose a proper destination
instead of :
 
ifstream ifs("passwords.txt");


use

 
ifstream ifs("C:/Windows/passwords.txt");


it will select the folder destination.

you will need to choose a proper destination
instead of :

ifstream ifs("passwords.txt");


use


ifstream ifs("C:/Windows/passwords.txt");


it will select the folder destination.



That file is in my project folder, so i dont have to put a destination path, but this doesnt matter, i can change it whenever i move the txt file.

The thing is i have no idea how to add those requirements
Topic archived. No new replies allowed.