got me stuffed why u need to hit enter twice, I compiled using Microsoft Visual C++ and didn't have too. Well I made some changes to your code as shown below, found 1 logic prob with your code (or it could be that u are just forcing user to have exactly 7 char passwords, well here is what I got
Code:
#include <iostream.h>
#include <string.h>
const int PASSQUANT=1;
const int MAX_CHARS=7;
const int ATTEMPTS=3;
int main()
{
char Password [PASSQUANT][MAX_CHARS];
char User_Password[MAX_CHARS], Buffer[255];////255 max keyboard buffer
int Trys=0;
int ReturnVal;
for (int i=0;i<PASSQUANT;i++)
{
cout << "Please enter supervisor password for level "<<i+1<< " access ";
cin.getline(Buffer,strlen(Buffer));///use the temp buffer to validate length
while (strlen(Buffer) > (MAX_CHARS-1))//now checking password length
{
cout << "INCORRECT PASSWORD LENGTH ! ";
cout << "\nPlease enter supervisor password for level "<<i+1<< "access ";
cin.getline(Buffer,255); //obtain password again
}
strcpy (Password[i],Buffer); //put the validated password into real variable
} //end first for loop
return 0;
}