#include<iostream>
usingnamespacestd;
constint MAX_SIZE = 200;
int compare(intone[], inttwo[], intsize)
{
for(inti = 0; i<size;i++)
if(one[i] <two[i])
return -1;
elseif(one[i] >two[i])
return 1;
return 0;
}
void main()
{
intN;
cout<<"Enter the array size: ";
cin>>N; //size must be less than MAX_SIZE
int one[MAX_SIZE];
int two[MAX_SIZE];
cout<<"Ente the elements of array one:"<<endl;
for(inti = 0; i<N;i++)
cin>>one[i];
cout<<"Ente the elements of array two:"<<endl;
for(inti = 0; i<N;i++)
cin>>two[i];
int result = compare(one,two,N);
if(result == 0)
cout<<"Array one is Equal to array two"<<endl;
elseif(result==-1)
cout<<"Array one is less than array two"<<endl;
elseif(result==1)
cout<<"Array one is greater than array two"<<endl;
}
sabaheen 0 Newbie Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.