#include <iostream>
#include <algorithm> // For std::any_of
bool isAnyValueLargerThanX(const int* arr, int size, int x) {
return std::any_of(arr, arr + size, [x](int value) { return value > x; });
}
int main() {
int arr[] = {1, 2, 3, 4, 5, 6};
int x = 4;
int size = sizeof(arr) / sizeof(arr[0]);
if (isAnyValueLargerThanX(arr, size, x)) {
std::cout << "There is a value larger than " << x << " in the array.\n";
} else {
std::cout << "No value is larger than " << x << " in the array.\n";
}
}
/*
run:
There is a value larger than 4 in the array.
*/