Write a function template thresholdOrDefault logic. It returns either the given value or a safe default:
thresholdOrDefault
template<typename T = int>
T thresholdOrDefault(T v, T def = {})
def
v
The program already reads a value and optionally a default, and calls thresholdOrDefault. You only need to implement the template function.
Example Input:
5
Output:
Input:
-3
0
-3 100
100
Test Cases
Test Results
Input
Expected Output