返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. string str1,str2;
  4. int main()
  5. {
  6.     cin>>str1>>str2;
  7.     if(str1[0]>str2[0])
  8.     {
  9.         cout<<str1<<" > "<<str2<<'\n';
  10.     }
  11.     else if(str1[0]<str2[0])
  12.     {
  13.         cout<<str1<<" < "<<str2<<'\n';
  14.     }
  15.     else
  16.     {
  17.         int i1=stoi(str1.substr(1));
  18.         int i2=stoi(str2.substr(1));
  19.         if(i1>i2)
  20.         {
  21.             cout<<str1<<" > "<<str2<<'\n';
  22.         }
  23.         else if(i1<i2)
  24.         {
  25.             cout<<str1<<" < "<<str2<<'\n';
  26.         }
  27.         else
  28.         {
  29.             cout<<str1<<" = "<<str2<<'\n';
  30.         }
  31.     }
  32.     return 0;
  33. }
複製代碼

TOP

返回列表