正在加载图片...
函数模板4-2 #include <iostream. h> 返回两个元素 template <class T> 的最大值 Tmax四Ta,Tb) return a>b? a: b; void main o cout<<"max(20,30)="<<max(20,30)<end1; cout < " max('t' iv)=" << max('t ivi)<< endli cout<<"max(10.1,15.2)="<<max(10.1,15.2)<<end1 北大青鸟7 函数模板 4-2 #include <iostream.h> template <class T> T max(T a, T b) { return a > b ? a : b; } void main() { cout << "max(20, 30) = " << max(20, 30) << endl; cout << "max('t', 'v') = " << max('t', 'v') << endl; cout << "max(10.1, 15.2) = " << max(10.1, 15.2) << endl; } 返回两个元素 的最大值
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有