1 #include <iostream> 2 using namespace std; 3 4 template <calss T1,class T2> 5 auto add(T1 t1, T2 t2) 6 { 7 return t1 + t2; 8 } 9 10 //auto自适应数据类型,自动推理 11 void main() 12 { 13 auto num = 10; 14 cout << typeid(num).name() << endl; 15 16 int a[5] = { 1,3,4,5,6 }; 17 18 for (auto i : a) 19 { 20 cout << i << endl; 21 } 22 23 cin.get(); 24 }