I have two arrays that both hold 5 sets of random numbers.
First I display a list of all the numbers in the first array; then I need to add to that list, any number that's not in the first array, and display each of those. To do that, I use another array to put the unique values in to display. I already have a function that displays the current array.
Here's the code where I have the problem:
//SIZE is defined in the beginning as 5.
printArray(array1);
int i, j;
//For each number in array1, compare each number in array2 to it.
for(j=0; j<SIZE; j++)
{
for(i=0; i<SIZE; i++)
{
if(array2[j] != array1[i])//?
{
arraySum[j] = array2[j];
std::cout << arraySum[j] << std::endl;
break;
}
}
}
//printArray(arraySum);