#include using namespace std; const int N = 110; int n = 4; string c[N] = {"", "AA", "BB", "CC", "DD"};//名称 int a[N] = {0, 1, 2, 3, 4};//序号 int b[N] = {0, 100, 90, 90, 100};//数值 bool cmp(int x,int y){ if(b[x]==b[y]) return a[x] b[y]; } int main() { //排序 sort(a + 1, a + 1+n,cmp); // 1 4 2 3 for (int i = 1; i <= n; i++) cout << c[a[i]] << " "; cout<