#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<iomanip>
using namespace std;
int f(char* a, char* b)
{
int l_a = strlen(a), l_b = strlen(b);
if (a[0] == '-' && b[0] != '-')//a<0 ,b>0
{
return -1;
}
else if (a[0] == '-' && b[0] == '-')//a<0 ,b<0
{
if (l_a == l_b)
{
if (strcmp(a, b) == 1)return -1;
else if (strcmp(a, b) == 0)return 0;
else return 1;
}
else if (l_a < l_b)return 1;
else return -1;
}
else if (a[0] != '-' && b[0] != '-')//a>0,b>0
{
if (l_a == l_b)
{
if (strcmp(a, b) == 1)return 1;
else if (strcmp(a, b) == 0)return 0;
else return -1;
}
else if (l_a < l_b)return -1;
else return 1;
}
else if (a[0] != '-' && b[0] == '-')//a>0,b<0
{
return 1;
}
}
int main()
{
int t;
cin >> t;
while (t--)
{
char a[100], b[100];
cin >> a >> b;
if (f(a, b) == 1)cout << ">" << endl;
else if (f(a, b) == 0)cout << "=" << endl;
else if (f(a, b) == -1)cout << "<" << endl;
}
}
大整数比较
猜你喜欢
转载自blog.csdn.net/YYDS777/article/details/115149840
今日推荐
周排行