I have a while
loop that initialize a list
with some double
s.
I would like to output the smallest value but what I have done so far seem not be working, because I don't get any output.
This is the relevant part of my code:
list<double> allDistances;
std::ifstream infile("ATXTFile.txt");
while (std::getline(infile, data)) {
//do some stuff
//dist are some double values
allDistances.push_back(dist);
}
cout << min_element(allDistances.begin(), allDistances.end()) << endl;
}