function_template.cpp

来自「经常使用的一些源程序.包括一些模板.在VC++6.0下通过.」· C++ 代码 · 共 47 行

CPP
47
字号
#include <iostream>
using namespace std;

/*main information*/
void info()
{
	cout << "function template  \n\n";//fill "*" with information
}

/*templet*/
template <typename type>
type max(type a, type b, type c)
{
	a = a > b? a: b;
	return a > c? a: c;
}

/*source code*/
void test()
{
	char a = 1;
	char b = 2;
	char c = 3;
	cout << "\n a  = " << a;
	cout << "\n b  = " << b;
	cout << "\n c  = " << c;
	cout << "\nmax = " << max(a, b, c);
}

/*information of source code owner*/
void end()
{
	cout << "\n\n______________\n";
	cout << "xiao zhiqiang\n";
	cout << "inxk@163.com\n";
	cout << "Sep,2006";
	getchar();
}

/*the main code*/
void main()
{
	info();
	test();
	end();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?