0
#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;
}
2
Contributors
1
Reply
3
Views
2 Years
Discussion Span
Last Post by rubberman
0

So, what is your problem? A C++ compiler on x86 or Mips systems should generate equally valid executables unless you are doing bit-manipulation and need to address little vs big-endian issues.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.