Вы меняете double
, с временным типом int
.
Вместо этого используйте:
double temp;
или лучше auto
:
const auto temp = dataPoints[j];
dataPoints[j] = dataPoints[j + 1];
dataPoints[j + 1] = temp;
или даже лучше, используйте std::swap
:
std::swap(dataPoints[j], dataPoints[j + 1]);
Если разрешено, вы можете даже использовать:
std::sort(std::begin(dataPoints), std::end(dataPoints), std::greater<>{});