int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
void FD_CLR(int fd, fd_set *set);
int  FD_ISSET(int fd, fd_set *set);
void FD_SET(int fd, fd...
                            
                            
                                分类:
其他好文   时间:
2014-05-14 00:03:02   
                                阅读次数:
440
                             
                    
                        
                            
                            
                                hash_map和map的用法很相似,只是底层机制有所不同。
hash_map容器采用的底层机制是hash table代码:
template ,
          class EqualKey = equal_to,
          class Alloc = alloc>
class hash_map
{
private:
  typedef hashtable, Key...
                            
                            
                                分类:
其他好文   时间:
2014-05-13 22:59:23   
                                阅读次数:
256
                             
                    
                        
                            
                            
                                __attribute__((packed))的作用  
在结构体变量的声明中,经常可以看到__attribute__((packed))修饰符。这是做什么用的呢?请看一下程序:
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int
int main()
{
    struct {
...
                            
                            
                                分类:
其他好文   时间:
2014-05-13 06:19:18   
                                阅读次数:
416
                             
                    
                        
                            
                            
                                题目来源:POJ 1006 Biorhythms
题意:给出3个周期第一次发生的时间 和 当前开始的天数 求三个周期下一次到达高峰期发生在哪一天
思路:这题很水 试一下我的模版而已
#include 
#include 
using namespace std;
typedef long long LL;
const int maxn = 10;
int a[maxn], m[maxn];
...
                            
                            
                                分类:
其他好文   时间:
2014-05-13 05:07:28   
                                阅读次数:
253
                             
                    
                        
                            
                            
                                #include #include #include #include #include 
#include #include #include #include #include using namespace std;struct 
MyStruct{ string stru; int ...
                            
                            
                                分类:
其他好文   时间:
2014-05-12 21:51:09   
                                阅读次数:
572
                             
                    
                        
                            
                            
                                其题目如下:#pragma pack(2)class A{public:	int 
i;	union U	{ char buff[13]; int i;	}u;	void foo() { }	typedef char* 
(*f)(void*);	enum{red, green, blue} ...
                            
                            
                                分类:
其他好文   时间:
2014-05-12 21:18:19   
                                阅读次数:
321
                             
                    
                        
                            
                            
                                在学习linux下编程时,不可避免的要学C了,下面先简单写写C下对C++中的类的模拟。我们要用到的是 
struct和函数指针,不懂的同学自行搜索这两个东东,我现在只写我的第一个实现,更多实现方式我会稍后补充。首先先上代码: 1 #include 2 
#include 3 4 struct Swen....
                            
                            
                                分类:
编程语言   时间:
2014-05-12 02:45:26   
                                阅读次数:
279
                             
                    
                        
                            
                            
                                邻接矩阵的图示:
构建一个这样的无向邻接矩阵。
参考网站: http://www.geeksforgeeks.org/graph-and-its-representations/
这里写了个类,增加删除图的操作。
#pragma once
#include 
#include 
class AdjListGraph
{
	struct Node
	{
		int dest;
		...
                            
                            
                                分类:
其他好文   时间:
2014-05-11 22:44:20   
                                阅读次数:
378
                             
                    
                        
                            
                            
                                这里用邻接表实现图的深度优先遍历,采用递归实现。
#include
using namespace std;
#define VERTEXNUM 5//结点数
struct  edgenode  
{  
    int to;  
    int weight; // 边的权值
    edgenode *next;  
};  
struct vnode  
{  
    int from...
                            
                            
                                分类:
其他好文   时间:
2014-05-11 20:46:16   
                                阅读次数:
519
                             
                    
                        
                            
                            
                                产生原因:多文件包含时,全局变量未用extern解决方法:直接在全局变量前加上extern即可,若要在在其他文件中使用,该变量声明下就ok了~~另外引出一个话题,你是不是也发现了这么一个现象??比如A.hA.cpp#include 
"A.h"#include "B.h"HWND ui_hwnd, h...
                            
                            
                                分类:
其他好文   时间:
2014-05-11 17:25:39   
                                阅读次数:
526