Please, just a little more explaining here.......I got a really good answer when I posted this last time, but I cant figure it out!!! Im new to this ok, and although I learn fast its this validation I JUST CANT seem to understand.My code below works fine IF I input a 6 digit password, if not it says 'invalid' (as it should) but then skips a level upwards. Something to do with whats left in keyboard buffer from cin.getline? I dunno. Debugger is no help (it seems). It was written on Borland 5 proff. I will really appreciate some festive spirit here !! Thanx in advance...
/// Program to initiate a password system/////////
//Allow administrator to input a 6 character password then any
//USER can try to login. The user will be told either invalid OR
//the LEVEL of access they have.i.e level of access will equal
// INT i.......
const int MAX_PASSWORDS =10;
const int CHAR_LIMIT=7;
void main ()
for (int i=0; i<=MAX_PASSWORDS; i++)
cout << "Please enter password for level " << i+1<< " access ";
cout << "Invalid length";
Seriously though...I have tried all sorts of combinations of brackets on the strlen(password[i] line to no avail.....I know I had to remove a getchar I had at the bottom, but why does it skip a level when an invalid password is input???? Oh yes that is after you press enter TWICE.?? WHY?? Many thanx in advance of a training session (which will be mucho appreciated)