c++ clamp

#include <iostream>
#include <algorithm>

int main() {
    // Step 1: Define variables
    int value = 25;
    int minValue = 10;
    int maxValue = 30;

    // Step 2: Use std::clamp to restrict the value within the specified range
    int clampedValue = std::clamp(value, minValue, maxValue);

    // Step 3: Display the original and clamped values
    std::cout << "Original value: " << value << std::endl;
    std::cout << "Clamped value: " << clampedValue << std::endl;

    return 0;
}