I need to write a password program in c++ that has the user make a password and i need to check for the following limitations.
Must be 5-12 characters long.
must contain letters and numbers.
sequences cannot repeat: such as 11, ndnd 123123, etc.
I don't know if i am approaching this the correct way, and i could use some tips.
The problem with the following code is that when i pass in the vector password into the function check_pass, its values turn into strange symbols, can anyone help me out here?
vector<char> password; is a local variable, so when you send it to get_pass it will modify the local copy of get_pass and not the main's copy, which probably you expect to change. So if you want to change the main's copy then pass it by reference.
In int get_pass(vector<char> password, int plength) You take plength as input from user and then return it at plength=get_pass(password, plength); . I don't know why you are passing it in the first place. Can't you make your function just like plength=get_pass(password); and for function int get_pass(vector<char>& password);
I don't understand, why you are using this password.resize(plength); Note: Vector is a dynamic array so you don't need to specify it's size.
In check_pass, I have no idea why you are using 'a', 'b' ... etc. can't you use password.size(); ?