0
Do you have any way of ordering a struct
in the form:
struct cidadecoord
{
char cidade[90];
int coordx, coordy;
}cidades[N];
N is worth 30 in the case, and I would like to order x and y coordinates, to find out which cities were further east, west, north and south. I’m struggling because I don’t know how to order keeping the information of the name of the city of each coordinate.
Everything depends on the order of your ordering. How do you want to order? In which priority? First x, then y? A distance, ie sqrt(x 2 + y 2), and then the name? Or the name comes first?
– rodrigogq
@rodrigogq In case, I would need to sort x and y separately. The values of x ordered would give me the city farthest west (the lowest value of x) farther east (the highest value of x) and with the values of y ordered I would know the city farther north and farther south, likewise.
– emic
Do you need to order or just find this information? If it is not necessary to order !
– rodrigogq
@I thought about ordering, because I thought it would be easier to find the highest and lowest value.
– emic