C++编程模板(头文件 + 常用函数)
2013-05-17 16:33
211 查看
//模板开始 #include <string> #include <vector> #include <algorithm> #include <iostream> #include <sstream> #include <fstream> #include <map> #include <set> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <iomanip> #include <queue> #include <string.h> #define SZ(x) (int(x.size())) using namespace std; int toInt(string s){ istringstream sin(s); int t; sin>>t; return t; } template<class T> string toString(T x){ ostringstream sout; sout<<x; return sout.str(); } typedef long long int64; int64 toInt64(string s){ istringstream sin(s); int64 t; sin>>t; return t; } template<class T> T gcd(T a, T b){ if(a<0) return gcd(-a, b); if(b<0) return gcd(a, -b); return (b == 0)? a : gcd(b, a % b); } #define LOCAL //模板结束(通用部分) int main() { #ifdef LOCAL //freopen("shuju.txt", "r", stdin); #endif return 0; }
相关文章推荐
- C++编程思想(卷二):深入理解模板
- C++编程入门系列之十(重载函数与函数模板)
- 终极Android.mk模板,遍历头文件和源文件目录
- STM32 C++编程 001 工程模板
- C++编程思想(卷二):设计模式:模板方法模式
- 终极Android.mk模板,遍历头文件和源文件目录
- STM32 C++编程 001 工程模板
- spring配置bean.xml头文件模板
- 终极Android.mk模板,遍历头文件和源文件目录
- 终极Android.mk模板,遍历头文件和源文件目录
- Discuz!X模板代码解析--Header(头文件)
- 模板(C++编程思想第二卷)
- C++编程->斐波那契数列模板判断实现
- C++编程点滴3:函数模板重载问题
- C++编程中的头文件包含问题
- C++笔记——c++编程思想(上)多态性、虚函数与模板
- C++编程模板2
- 主流框架(SSH及SSM)配置文件的模板头文件
- C++内联函数、函数模板之于头文件
- C++编程思想(2nd卷一):模板简介