// Ok, very simple - for a game. No supercrunching or anything.
// I suppose we could start like this:
// A little complicated for a starter effort.
class supercruncher
{
int[][] pwStore = new int[3][4];
supercruncher()
{
// conceptual - to be coded .....
// We can unroll the loop for simplicity.
for(pwStore.length) = passwordAsInt;
}
// ..... other code here
if(checkPassword(int suppliedValue))
{
int loopControl = pwStore.length;
do
{
// this next line is not correct
if(pwStore.[--loopControl] == suppliedValue)
{
return true;
}
}
while(loopControl > 0);
return false;
}
}
// This is ineffective - always checking is something one
// would place in the run loop in a game
if(password[0]==""+num1+num2+num3+num4)
Also, for four numbers - the way I have the array is incorrect. Several things in the code are indeterminate until you provide us some feedback....