📄 templ2.cpp
字号:
/*
templ2. Testing template with two arguments
*/
#include <stdio.h>
template <class T, class U> T Product (T x, U y);
int main ()
{
printf ("Return for int, double is %f\n",
(float) Product (2, 3.6));
printf ("Return for double,int is %f\n",
(float) Product (3.6, 2));
printf ("Return for int,int is %f\n",
(float) Product (2, 3));
printf ("Return for double,double is %f\n",
(float) Product (3.6, 2.4));
return (0);
}
template <typename T, typename Y> T Product (T x, Y y)
{
return (x * y);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -