1. Matching Numbers in Arrays

Code:
```for(int j = 0; j <=5; j++)
{
if(Un[j]==Wn[j])
{
counter++;
cout << Un[j] << " ";
}
}```
For some reason the code above doesn't work in my program Any solutions?

2. what happens? What are contained in all those vars? How bout postin it all (at least post the code with the declarations)

3. The beef:

Code:
```int Un[6] = {0}, Wn[6] = {0};

Input:

cout << endl << "Please Enter Six Consecutive Numbers Ranging from 1-53:\n" << endl;
cin >> Un[0];

for(int k = 1; k <= 5; k++)
{
int n = k - 1;	// Previous value

if(Un[n] >= 1 && Un[0] <= 53)	// If it's valid
{
cin >> Un[k];	// Get next value
}
else
{
cout << "\a";
goto Input;	// Else prompt again
}
}

for(int i = 0; Wn[i] == 0; i++)	// Fill Wn[] with random values
{
Wn[i] = rand()%53;
}

cout << endl << endl << "Matching Numbers: ";

int counter = 0;	// Keep track of matching numbers

for(int j = 0; j <=5; j++)
{
if(Un[j]==Wn[j])
{
counter++;
cout << Un[j] << " "; // This doesn't show
}
}

cout << endl << endl

if(counter==0)	// These don't show either
{
//.....
}
else if(counter==1)
{
//.....
}
else if etc etc...```

4. Code:
```#include <iostream>
#include <cstdlib>
#include <ctime>

int main(){

using namespace std;

srand(time(NULL));//first randomise

const int nArraySize = 6;
int Un[nArraySize] = {0},
Wn[nArraySize] = {0};

cout << endl << "Please Enter Six Consecutive Numbers Ranging from 1-53:\n" << endl;

for(int i = 0;i < nArraySize;++i){
cin >> Un[i];
if(Un[i] > 53){//if over 53
cout << "Not under 54!" << endl;
--i;//lower count
}
}

for(int i = 0;i < nArraySize;++i)
Wn[i] = rand()%54;//between 0 and 53

cout << endl << endl << "Random Numbers: ";

for(int i = 0;i < nArraySize;++i)
cout << Wn[i] << " ";

cout << endl << endl << "Matching Numbers: ";

int counter = 0;// Keep track of matching numbers

for(int i = 0;i < nArraySize;++i)
for(int j = 0;j < nArraySize;++j)//nested loop
if(Un[i]==Wn[j]){
counter++;
cout << Un[i] << " ";
}
}```

5. Thanks, it all works now!