templ2.cpp
来自「这些源代码」· C++ 代码 · 共 26 行
CPP
26 行
/*
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 + =
减小字号Ctrl + -
显示快捷键?