how to set a variable to infinity in c++

#include <limits>

int main() {
    // Step 1: Include the <limits> header
    #include <limits>

    // Step 2: Use the std::numeric_limits template to get the maximum finite value
    int infinity = std::numeric_limits<int>::max();

    // For floating-point types (e.g., double), use:
    // double infinity = std::numeric_limits<double>::infinity();

    return 0;
}