1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#include <iostream>
using namespace std;
bool isreflexive(int ar[],int n,int ar2[],int nn)
{
int j,i = 0;
bool hold = true;
cout<<"n " <<n<<endl;
for(i = 0; i <n; i++)
{
cout<<"i "<<i<<endl;
if(ar[i] == ar2[j])
{
cout<<"match"<<endl;
j++;
}
else
{
cout<<"not a match"<<endl;
j++;
}
}
}
int main()
{
int ar[] = {1,2,3,4,4,7,7 };
int ar2[] = {1,2,3,4,7,4,7};
int n = sizeof(ar)/sizeof(int);
int nn = sizeof(ar2)/sizeof(int);
//cout<<n<<endl;
bool reflexive = isreflexive(ar,n,ar2,nn);
cout<< reflexive <<endl;
}
|