wap in c++ to understand function template

#include <iostream>

// Step 1: Define a function template
template <typename T>
T add(T a, T b) {
    return a + b;
}

int main() {
    // Step 2: Use the function template with different data types
    int result1 = add(5, 3);
    double result2 = add(2.5, 3.7);

    // Step 3: Display the results
    std::cout << "Result 1: " << result1 << std::endl;
    std::cout << "Result 2: " << result2 << std::endl;

    return 0;
}