double min_positive = std::numeric_limits<double>::max(); for (double num : numbers) { if (num > 0 && num < min_positive) { min_positive = num; } } if (min_positive == std::numeric_limits<double>::max()) { std::cout << "No positive numbers found in the array." << std::endl; } else { std::cout << "The minimum positive number in the array is: " << min_positive << std::endl; } return 0;
int main() {
double min_positive = std::numeric_limits<double>::max();std::vector numbers = {3.5, -2.0, 1.8, -4.7, 0.5};
for (double num : numbers) {
if (num > 0 && num < min_positive) {
min_positive = num;
}
}
if (min_positive == std::numeric_limits<double>::max()) {
std::cout << "No positive numbers found in the array." << std::endl;
} else {
std::cout << "The minimum positive number in the array is: " << min_positive << std::endl;
}
return 0;
}