代码改变世界

随笔分类 -  TestCodes

makefile 示例1

2015-03-13 10:16 by sylar_liang, 227 阅读, 收藏,
摘要: # 设置编译器CC = g++# -fPIC 作用于编译阶段,告诉编译器产生与位置无关代码# -D宏定义,相当于C中的全局#define,可以通过宏定义来控制源程序的编译,例如:# #ifdef _FILELINE# printf("Hello Yu Qiang, How are you?\n");... 阅读全文

transform 函数测试

2015-03-11 18:01 by sylar_liang, 161 阅读, 收藏,
摘要: #include #include #include #include using namespace std;// 自定义泛函数template void PRINT_ELEMENTS(const T& coll, const char * str=""){ typename T::cons... 阅读全文

Stream_iterator 测试

2015-03-11 17:37 by sylar_liang, 171 阅读, 收藏,
摘要: #include #include #include #include #include // istream_iterator 与 ostream_iterator 头文件using namespace std;// 功能:// 1.从标准输入读取所有输入文字// 2.排序// 3.将它们打印到... 阅读全文

max_element 返回值上限与下限

2015-03-11 17:36 by sylar_liang, 421 阅读, 收藏,
摘要: #include #include #include using namespace std;//using namespace std::list;//using namespace std::cout;//using namespace std::endl;int main(int argc, ... 阅读全文

auto_ptr 用例1

2015-03-10 17:45 by sylar_liang, 153 阅读, 收藏,
摘要: auto_ptr // 头文件 std::auto_ptr ptr1(new ClassA); // okstd::auto_ptr ptr2 = new ClassA; // error 不允许 赋值(assign)初始化方式auto_ptr赋值会导致所有权的转移auto_ptr错误运用:1.au... 阅读全文

inet_pton inet_ntop inet_aton htonl

2015-03-01 11:07 by sylar_liang, 330 阅读, 收藏,
摘要: #include #include #include #include // memory zero#include #include // AF_INET#include // inet_* 头文件#include // struct sockaddr_inint main(int arg... 阅读全文