问题 填空题

下列程序的输出结果是______。
#include<iostream>
using namespace std;
template<typename T>
T fun(T a,T b)return(a<=b)a:b;
int main()

cout<<fun(3,6)<<‘,’<<fun(3.14F,6.28F)<<end1;
return 0;

答案

参考答案:3,3.14。

解析: C++编译系统将根据实参表中的实参的类型来确定函数的形参列表中的类型。函数fun(3,6)返回的值为3,函数调用fun(3.14F,6.28F)返回的值为3.14。

单项选择题
填空题