I am trying to find the intersection of 2 arrays... I have code written but cannot seem to find why it isn't working correctly... If someone could help a little bit that would be great,
int main(int argc, _TCHAR* argv[])
{
getArray1;
getArray2;
getIntersection(Array1,Array2,Array3);
printIntersection;
return 0;
}
/************************************************** ************************************************** ***************
Get Array1 and Array2 Function
Input:
Output: 2 Sets of 10 numbers
************************************************** ************************************************** ***************/
void getTen(Array1, Array2)
{
int Array1[10];
int Array2[10];
int i=0;
for(i=0;i<10;i++)
printf("Enter 1st Array");
scanf("%d",Array1[i]);
printf("Enter 2nd Array");
scanf("%d",Array2[i]);
}
/************************************************** ************************************************** ************
Intersection Function
Input: Array1 and Array2
Output: Intersection number of Array1 and Array2
************************************************** ************************************************** ************/
int findIntersection(int Intersection[]
int i;
int j;
int k;
getArray1();
getArray2();
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
if(getArray1[i]==getArray2[j])
{
k++;
}
if (getArray1[i] != getArray2[j]);
{
}
return k;
}
/************************************************** ************************************************** **********
Print Intersection Function
Input: The same numbers in Array1 and Array2
Output: Printing numbers in the intersection array
************************************************** ************************************************** *********/
void printIntersection(int Array3[10])
{
int i;
for(i=0;i<10;i++)
printf("%d\n", Array3[i]);}



LinkBack URL
About LinkBacks


