hey why code is not able to sort on the basis of “e” when the inputs are : 100 4,4 5,200 6,2 5
//JUST PRACTISING
#include<cstdio>
#include<iostream>
#include<list>
#include<vector>
#include<utility>
using namespace std;
struct node
{
int u;
int w;
}road[10];
int comp(node a,node b)
{
if(a.u<b.u)
return a.u;
else
return b.u;
}
int main()
{
for(int i=0;i<4;i++)
{ int a,b;
scanf("%d%d",&road[i].u,&road[i].w);
}
sort(road,road+4,comp);
printf("\n\n\n\n");
for(int i=0;i<4;i++)
{
printf("%d %d\n",road[i].u,road[i].w);
}
system("pause");
}