arrays and validation (basic stuff)
Hello , I have been pulling my hair out for a week now. I am just learning to program. I have some code here, but i cant grasp 2 dimensional arrays, or moreover why this code doesnt work. Any help is appreciated.
//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 ()
{
char Password[MAXIMUM][CHARS];
int i=0;
for (i; i<MAXIMUM; i++)
{
cout << "Please enter Supervisor password for level " << i+1<< " access ";
cin.getline(Password[i],CHARS);
if(strlen(Password[i])!= CHARS)
{
cout << "Invalid length";
cin.getline(Password[i],CHARS);
}
}
getchar();
}
this is only the first part but the debugger shows WEIRD stuff in password[]. Using Borland 5.Any tips for an aspiring ! learner?