0
I’m trying to compare two variables of a struct type, but it’s returning error.
struct aresta{
int v1;
int v2;
int peso;
};
...
aresta peso[62816];
aresta aux;
int i, j=0;
for(i=0; i<(tamanhoVetor - 1); i++){
int menor = i;
for(j=(i+1); j<tamanhoVetor; j++){
if(peso[menor] > peso[j])){ //ERRO RETORNA DESTA LINHA
menor = j;
}
}
aux = peso[menor];
peso[menor] = peso[i];
peso[i] = aux;
}
Complete code: https://pastebin.com/vQTbkY60
The error line in your code is not as you have here in the question. Change the code you have in the question so that it is not different, and also take advantage and put the error that the compiler gives.
– Isac
C++ does not support comparison between two structs, unless you overload the operator.
– user72726