So, here is my program (C++). In it, I have created the first array (winningValues) to be assigned 5 random numbers between 0 and 1. The second array consists of numbers that the user has input. Assuming the arrays are correctly set up (I think they are), how would I go about printing which numbers match? For example, if array 1 consisted of 1, 2, 3, 4, 5, and array 2 consisted of 1, 2, 3, 5, 0, the output would print 1, 2, and 3 to the screen because they were the same number in the same location.
constint SIZE=6;
int array1[SIZE]{1,2,4,4,5,8};
int array2[SIZE]{1,2,3,4,5,6};
///the following elements are equal and at the same index in two diff arrays.
for(int i = 0; i < SIZE; i++)
{
if(array1[i] == array2[i])///equality operator
std::cout<<array1[i]<<" ";///print either because both are equal.
}
So I revised it and got this, but it's only printing out one number at the end.... I'm sorry, this is my first language learning at university and I am utterly lost at what's going on here...