Hello! I have a problem to do. I already did some part of it, however I stuck and don't know exactly what to do next.
The question: " You are given two arrays of ints, named A and B. One contains AMAXELEMENTS and the other contains BMAXELEMENTS. Write a Boolean-valued function that returns true if there is at least one point in A that is the same as a point in B, and false if there is no match between two arrays. "
The two arrays are made up by me, I think if I know how to compare two arrays I will be fine, and I will be able to finish my problem.
This is what I have so far (I changed AMAXELEMENTS to AMAX, and BMAXELEMENTS to BMAX):
#include <iostream>
using namespace std;
int main()
{
const int AMAX = 5, BMAX = 6;
int i;
bool c1 = true, c2 = false;
int A[AMAX] = { 2, 4, 1, 5, 9 };
int B[BMAX] = { 9, 12, 32, 43, 23, 11 };
for (i = 0; i < BMAX; i++)
if (B[i] == A[i]) // <---- I think this part has to look
// different, but I can't figure it out.
cout << c1 << endl;
else
cout << c2 << endl;
return 0;
}