题目:
代码:
#include <bits/stdc++.h>
#include<cstring>using namespace std;struct Num{double fenzi;double fenmu;char fenhao;};bool cmp(Num r1,Num r2){return r1.fenzi/r1.fenmu<r2.fenzi/r2.fenmu;}int main(){int n;Num num[n];cin>>n;
for(int i=0;i<n;i++)
{cin>>num[i].fenzi>>num[i].fenhao>>num[i].fenmu;
}
sort(num,num+n,cmp);
for(int i=0;i<n;i++)
{cout<<num[i].fenzi<<"/"<<num[i].fenmu<< endl;
}
return 0;}