2
I made the code using structure, I wanted to know if with classes it would be more efficient. I’m doing it in C++ Builder. The idea of the code and the following: create a list of problems, where during the execution of the code will be added and removed numerous problems (of the type struct
or class
)
struct {
TList *cidadesvisitadas; // lista iniciada com uma cidade ,vou acrescentando ate 30 cidades
float distancia;
TList *cidadescanditadas; // lista iniciada com 29 cidades , que no decorrer do codigo vai sendo retirada uma a uma e adicionada na lista de cidades visitadas
};
In the list of problems, an initial problem will be added (unresolved), and then removed this problem turns into three new problems (unresolved) that are added again to the list of problems, then remove a problem again from the list of problems and turns into three other problems and so on. The list at the end of the run is empty (add and remove, when the problem is solved it does not return to the list). Problems already dynamically staggered (there will be millions of problems)
if I change the struct
(Problem) by class
(Problem), the code is more correct?
Take a look at [tour], you can vote on everything on the site you think is good content, and accept an answer in your questions, as you already know how to do.
– Maniero