C/C++
meiping_download
这个作者很懒,什么都没留下…
展开
-
GCC 链接库文件时的顺序问题
困扰了相当长的时间,gcc在链接库文件时是从左到右扫描,而且不会重复扫描,这样任何函数的定义应该放在使用者的后面,不同的编译器对这个问题有不同的处理方式,有的编译器可以实现顺序无关,但在没有明确的情况下应该遵循原有的规则。 下面是有关gcc说明的一段话,摘自网络 On Unix-like systems, the traditional behavior of compilers...原创 2011-02-22 21:15:31 · 395 阅读 · 0 评论 -
C++ 中关于函数传对象和传引用的混淆问题
代码如下 #include <iostream> using namespace std; void tt(int& i) { cout<<i<<endl; } void tt(int i) { cout<<i<<endl; } int mai...原创 2011-02-22 22:00:14 · 129 阅读 · 0 评论 -
如何用CGI(C/C++)输出二进制内容
用CGI输出文本文件已是司空见惯,输出二进制呢?你尝试过吗? 下面的代码演示在linux下想浏览器输出Excel文件 tt.cpp #include <fstream> #include <iostream> #include <string> #include <vector> #include <algorit...原创 2011-02-22 22:12:22 · 411 阅读 · 0 评论 -
多米诺覆盖问题的回溯解法
题目:现有6*6大小的棋盘和18张多米诺骨牌,每张牌能覆盖2个棋格,求将多米诺骨牌完全覆盖棋盘的所有组合? #include <iostream> #include <string> #include <map> #include <stack> #include <set> #include <sstrea...原创 2011-02-22 22:17:03 · 597 阅读 · 0 评论 -
标准库算法(sort)的用法
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; bool compare(int l, int r) { return l < r; // 如果写死返回真则排序算...原创 2011-02-22 22:19:01 · 355 阅读 · 0 评论 -
多目录编译经典makefile
# Readme: # use: make config # use: make dir # use: make # use: make clean # use: make rebuild # use: make cleanall # use: make test # use: make # firs of all, use "make config" or "make...原创 2011-02-22 22:25:51 · 112 阅读 · 0 评论