Hello,
I'm having a bit of a struggle getting my head around a small problem im having.
I am trying to write a program that allows the user to enter in values which are stored in arrays. These numbers are a unique ID.
The entered data consists of 4 numbers between 10 and 999.
The values are stored like this.
int ID1[] = {171, 38, 239, 26};
int ID2[] = {105, 54, 171, 213};
int ID3[] = {194, 96, 17, 28};
int ID4[] = {78, 67, 68, 209};
int ID5[] = {138, 014, 113, 151};
I now need to write code that will use a for loop that will check EVERY array element against a scanned ID.
The for loop will run dependent on the number of cards entered which is manually stored in a variable called IDs.
So I want to check each element of the scanned ID which is stored in a similar array against each of the same element in every stored ID sort of like the pusdo code below.
int IDs = 5;
for (int i = 0; i < IDs; i++) {
int j = 0;
boolean match = true;
while (j < rfid.uid.size)
{
if (!(storedidByte[j] == scannedID[j]))
{
match = false;
}
i++;
}
}
Whats the best way to do this?
Do I need a multi dimensional array?