Search
 
SCRIPT & CODE EXAMPLE
 

CPP

intersection.cpp

#include"iostream"

using namespace std;


int A[] = {2, 4, 3, 5, 6, 7};
int B[] = {9, 2, 7, 6};

int main()
{
    int sizeA = sizeof(A)/sizeof(int);

    int sizeB = sizeof(B)/sizeof(int);

    int big =  (sizeA > sizeB) ? sizeA : sizeB;

    int small =  (sizeA > sizeB) ? sizeB : sizeA;

    for (int i = 0; i <big ;++i)
    {
        for (int j = 0; j <small ; ++j)
        {
            if(A[i] == B[j])
            {
                cout<<"Element is -->"<<A[i]<<endl;
            }
        }
    }

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: Converting to string c++ 
Cpp :: convert int to string in c++ 
Cpp :: automatic legend matlab 
Cpp :: c++ initialize a vector 
Cpp :: c++ looping through a vector 
Cpp :: How to get cursor position c++ 
Cpp :: c++ compile to exe command line 
Cpp :: double to float c++ 
Cpp :: c++ float and double 
Cpp :: cpp vector 
Cpp :: input full line as input in cpp 
Cpp :: how to make window resizable in sdl 
Cpp :: c++ syntax 
Cpp :: how to use command line arguments with integers in c++ 
Cpp :: rotate an array of n elements to the right by k steps 
Cpp :: define vector with size and value c++ 
Cpp :: how to make a function in c++ 
Cpp :: overload subscript operator cpp 
Cpp :: print in c ++ 
Cpp :: how to copy vector to another vector in c++ 
Cpp :: reference c++ 
Cpp :: how to check if vector is ordered c++ 
Cpp :: c++ map lookup 
Cpp :: sliding window c++ 
Cpp :: arduino falling edge 
Cpp :: how to find product of a given numbers in c++ 
Cpp :: How to pass a multidimensional array to a function in C and C++ 
Cpp :: c++ check if number is even or odd 
Cpp :: remove linked list elements leetcode 
Cpp :: nth fibonacci number 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =