← Back to Question List
C++ Quiz #114
Choosing the Type Yourself
The call writes the template argument explicitly: larger<double>(3, 4.5). What happens?
📄 Code
1#include <iostream>23template <typename T>4T larger(T a, T b) {5 if (a > b) {6 return a;7 }8 return b;9}1011int main() {12 std::cout << larger<double>(3, 4.5) << "\n";13 return 0;14}