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.......
////////////////////////////////////////////////////////////////////////////////

#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
#include<string.h>

const int MAX_PASSWORDS =10;
const int CHAR_LIMIT=7;

void main ()
{
char Password[MAX_PASSWORDS][CHAR_LIMIT];
char User_Password;


for (int i=0; i<=MAX_PASSWORDS; i++)
{
cout << "Please enter password for level " << i+1<< " access ";
cin.getline(Password[i],CHAR_LIMIT);

if(strlen(Password[i])!= CHAR_LIMIT-1)
{
cout << "Invalid length";
cin.getline(Password[i],CHAR_LIMIT);
}
}

}


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)