不用for(int i=1;i<=1;i++),直接把他删掉,然后在struct结构体里面写一个int xu;为他的序号,然后把cmp改一下:
if(x.s==y.s)return x.xu>y.xu;
return x.s>y.s;
然后再到main中的for输入里面,写一个:
a[i].xu=i;
by 1ooper @ 2023-05-02 19:25:00
把那个最后输出的a[i]改成a[0]
by 1ooper @ 2023-05-02 20:13:33
a[1]
by 1ooper @ 2023-05-03 22:54:19