求解,为什么不能重载<
查看原帖
求解,为什么不能重载<
601674
zldy楼主2024/8/13 10:57
#include<bits/stdc++.h>
using namespace std;
string a[23];
const bool operator<(const string &x,const string &y) { return (y+x>x+y); }
//bool cmmp(const string &x, const string &y) { return (x + y < y + x); }
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
      cin >> a[i];
    sort(a+1,a+n+1);
    for (int i = n; i >=1 ;i -- )
      cout << a[i];
    return 0;
}

为什么用注释掉的那一行就没问题 用重载就不对呢,求大佬解答

2024/8/13 10:57
加载中...