|
#include<bits/stdc++.h>
using namespace std;
double a[10]={1998.6,2002.9,1983.2,2013.4,1885.4,2017.5,2102.2,1997.7,2010.8,2015.4};
int i;
float sth(float n)
{
float c;
int b;
b=int(n);
c=n-b;
return c;
}
bool cmp(float a,float b)
{
if(sth(a)!=sth(b))
{
return sth(a)>sth(b);
}
else
return a<b;
}
int main()
{
sort(a,a+10,cmp);
for(i=0;i<=9;i++)
{
cout<<a[i]<<" ";
}
} |
|