have a look at the comments
Code:
//prog to allow supervisor to input 10 passwords and then allow user to try to
//login. Prog should tell user what level of access they have upon entering a
//valid password.Password will be 6 characters long.
#include <iostream.h>
#include <iomanip.h>
#include<string.h>
const int MAXIMUM = 10;
const int CHARS = 7;
void main(void)
{
char password[MAXIMUM][CHARS];
for(int i = 0; i<MAXIMUM; i++)
{
cout << "Please enter Supervisor password for level " << i + 1 << " access : ";
cin.getline(password[i], CHARS);
// this is where your problem is. cin.getline(password, CHARS) retrieves CHARS-1 characters max
// because it null-terminates the string. so you'll only ever get 6 characters in the buffer.
// what you should do is check to see if the length is == to CHARS - 1 like this:
if(strlen(password[i]) != CHARS - 1)
{
cout << "Invalid length";
cin.getline(password[i], CHARS);
}
}
}
By the way, there are other bugs in there... but i'll let you figure them out