#include<iostream>

using namespace std;

int main(){

       long long x,a,b,y;

       while(~scanf("%lld%lld%lld%lld",&x,&a,&y,&b)){

              long long x1,x2;

              x1=x/a;

              x2=y/b;

              if(x1>x2)

                     cout<<">"<<endl;

              else if(x1<x2)

                     cout<<"<"<<endl;

              else{//当判断相等时,当两个数很接近时,因为计算机无法判断,会产生误差,不是绝对的相等

                     long long y1,y2;

                     y1=x%a;//这里就解决了这个问题

                     y2=y%b;

                     if(b*y1==y2*a)

                            cout<<"="<<endl;

                     else if(b*y1==a*y2)

                            cout<<"="<<endl;

                     else

                            cout<<">"<<endl;

              }

       }

       return 0;

}

扩展

还要防止爆数据类型,在相乘的时侯,在相乘之前还要除以公倍数

简便

#include<iostream>

using namespace std;

int main(){

    long long a,b,x,y;

    long long sum;

    while(scanf("%lld%lld%lld%lld",&x,&a,&y,&b)!=EOF){

        sum=x*b-a*y;//除法变乘法就解决了这个问题

        if(sum==0)

            cout<<"="<<endl;

        else if(sum>0)

            cout<<">"<<endl;

        else

            cout<<"<"<<endl;

    }

     

     

    return 0;

}