struct num
{
int c;
int d;
};
bool worse(const num& r1, const num& r2)
{
if (r1.c < r2.c)
return true;
else
return false;
}
int main()
{
num p[5] = { {5,3},{0,2},{3,5},{4,2},{7,3} };
sort(p, p + 5, worse);
reverse(p, p+5 );
for (int i = 0; i < 5; i++)
cout << p[i].c << " "<<p[i].d << endl;
system("pause");
}
{
int c;
int d;
};
bool worse(const num& r1, const num& r2)
{
if (r1.c < r2.c)
return true;
else
return false;
}
int main()
{
num p[5] = { {5,3},{0,2},{3,5},{4,2},{7,3} };
sort(p, p + 5, worse);
reverse(p, p+5 );
for (int i = 0; i < 5; i++)
cout << p[i].c << " "<<p[i].d << endl;
system("pause");
}