enum IMAGEFORMAT { JPG, BMP} imageExt;int GetImageFormat(char *ext){ if(!stricmp(ext, "jpg")) imageExt = JPG; else if( !stricmp(ext, "bmp") ) imageE.....
分类:
其他好文 时间:
2014-08-16 19:44:10
阅读次数:
169
公司每个project代码中,都有一个Config类,作为模块启动的配置。其实现如下struct Config { int num; char * file_name; int load_from_file(const char* filename);}int Config::load_from_f...
分类:
其他好文 时间:
2014-08-16 16:22:30
阅读次数:
192
struct point{ int x,y;} p[N],stack[N];bool cmp(point A,point B){ if(A.y==B.y)return A.x1&&cross(stack[top-2],stack[top-1],p[i])=0; i--) { ...
分类:
其他好文 时间:
2014-08-16 16:20:40
阅读次数:
199
链表排序,要求使用 O(nlgn) 时间,常量空间。使用归并的思路/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int ...
分类:
其他好文 时间:
2014-08-16 15:02:00
阅读次数:
162
Java1.5提供了关键字enum,能够通过该关键字方便得定义自己须要的枚举类型,比方enumSeason{SPRING,SUMMER,AUTUMN,WINTER}就定义了一个季节枚举类型。在本例中,对于Season.SPRING这个对象,Season.SPRING.name()能够得到该对象的字符...
分类:
编程语言 时间:
2014-08-16 14:58:20
阅读次数:
198
public enum WeekDay { SUN(1, "Sunday", "SUN"), MON(2, "Monday", "MON"), TUE(3, "Tuesday", "TUE"), WED(4, "Wednesday", "WED"), THU(5, "Thursday", ...
分类:
其他好文 时间:
2014-08-16 13:42:30
阅读次数:
218
1 include 2 using namespace std; 3 #include 4 5 typedef int T; 6 7 class List{ 8 struct Node{ 9 T data1;10 ...
分类:
其他好文 时间:
2014-08-16 12:28:50
阅读次数:
200
#include
struct S{int n;int a[20];};
void f(struct S *p)
{
int i,j,t;
for(i=0;in-1;i++)
for(j=i+1;jn;j++)
if(p->a[i]>p->a[j])
{
t=p->a[i];
p->a[i]=p->a[j];
p->a[j]=t;
}
}
main...
分类:
其他好文 时间:
2014-08-15 23:51:59
阅读次数:
433
基本结构
(这部分的地址均为网络地址)
1、struct sockaddr:通用套接字地址结构
此结构用于存储通用套接字地址。
数据结构定义:
typedef unsigned short sa_family_t;
struct sockaddr {
sa_family_t sa_family; /* address family, AF_xxx */...
分类:
其他好文 时间:
2014-08-15 22:35:49
阅读次数:
443
#include #include #include #include #include #include using namespace std;#define eps 1e-8#define MAXX 1000010typedef struct point{ double x; do...
分类:
其他好文 时间:
2014-08-15 22:29:19
阅读次数:
223