⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 template.cpp

📁 随书源码.新手学习不错的代码练习代码。多多指教。
💻 CPP
字号:
// Section 10.1
// $ CC template.cpp

/*

minimum of 10 and 20 is: 10
minimum of 10.3 and 20.6 is: 10.3

*/

#include <iostream>
using std::cout;
using std::endl;

template <class Type>
        Type min( Type a, Type b ) {
                return a < b ? a : b;
}

int main() {
        // ok: int min( int, int );
	cout << "minimum of 10 and 20 is: " << min( 10, 20 ) << endl;

        // ok: double min( double, double );
	cout << "minimum of 10.3 and 20.6 is: " << min( 10.3, 20.6 ) << endl;

        return 0;
}

⌨️ 快捷键说明

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