WPE|52wpe|我爱WPE

 找回密码
 注册会员
搜索
  • 3471查看
  • 4回复

主题

好友

958

积分

高级会员

发表于 2010-1-30 16:41:43 |显示全部楼层
/**

    * C 和 C++ 的谁好谁坏的争论还在不断的继续,C语言的使用非常的广范,很多大型的系统都是用C 语言来写的。

    * C++ 似乎有更好的编程范式。支持面向对象,模版,省去了很多处理。

    * C++ 最好不要滥用,具体问题,具体分析。

    *

    */

    #include

    #include

    /**

    * 通用链表声明部分

    */

    struct list_head {

    struct list_head *next, *prev;

    };

    #define LIST_HEAD_INIT(name) { &(name), &(name) }

    #define LIST_HEAD(name) \

    struct list_head name = LIST_HEAD_INIT(name)

    #define INIT_LIST_HEAD(ptr) do { \

    (ptr)->next = (ptr); (ptr)->prev = (ptr); \

    } while (0)

    static void __list_add(struct list_head * new, struct list_head * prev, struct list_head * next);

    static void list_add(struct list_head *new, struct list_head *head);

    static void list_add_tail(struct list_head *new, struct list_head *head);

    static void __list_del(struct list_head * prev, struct list_head * next);

    static void list_del(struct list_head *entry);

    static void list_del_init(struct list_head *entry);

    static int list_empty(struct list_head *head);

    static void list_splice(struct list_head *list, struct list_head *head);

    #define list_entry(ptr, type, member) \

    ((type *)((char *)(ptr)-(size_t)(&((type *)0)->member)))

    #define list_for_each(pos, head) \

    for (pos = (head)->next; pos != (head); pos = pos->next)

    #define NEW_LIST_NODE(type, node) \

    {\

    node = (struct type *)malloc( sizeof(struct type)); \

    if (node == NULL) exit(-1);\

    }

    #define FREE_LIST(type, p, list_name)\

    {\

    struct type *posnode;\

    while(!list_empty(&(p)->list_name)) {\

    posnode = list_entry((&(p)->list_name)->next, type, list_name);\

    list_del((&(p)->list_name)->next);\

    free(posnode);\

    }\

    }

    /**

    * 通用链表实现部分

    */

    static void __list_add(struct list_head * new, struct list_head * prev, struct list_head * next)

    {

    next->prev = new;

    new->next = next;

    new->prev = prev;

    prev->next = new;

    }

    static void list_add(struct list_head *new, struct list_head *head)

    {

    __list_add(new, head, head->next);

    }

    static void list_add_tail(struct list_head *new, struct list_head *head)

    {

    __list_add(new, head->prev, head);

    }

    static void __list_del(struct list_head * prev, struct list_head * next)

    {

    next->prev = prev;

    prev->next = next;

    }

    static void list_del(struct list_head *entry)

    {

    __list_del(entry->prev, entry->next);

    }

    static void list_del_init(struct list_head *entry)

    {

    __list_del(entry->prev, entry->next);

    INIT_LIST_HEAD(entry);

    }

    static int list_empty(struct list_head *head)

    {

    return head->next == head;

    }

    static void list_splice(struct list_head *list, struct list_head *head)

    {

    struct list_head *first = list->next;

    if (first != list) {

    struct list_head *last = list->prev;

    struct list_head *at = head->next;

    first->prev = head;

    head->next = first;

    last->next = at;

    at->prev = last;

    }

    }

    typedef struct int_list

    {

    struct list_head list;

    int data;

    } int_list, *pint_list;

    void test_int_list()

    {

    struct int_list *dlink, *newnode, *posnode;

    struct list_head *pos;

    int i;

    NEW_LIST_NODE(int_list, dlink);

    INIT_LIST_HEAD(&dlink->list);

    for (i = 1; i < 10; i++)

    {

    NEW_LIST_NODE(int_list, newnode);

    newnode->data = i;

    list_add_tail(&newnode->list, &dlink->list);

    }

    list_for_each(pos, &dlink->list) {

    posnode = list_entry(pos, int_list, list);

    printf("%d ", posnode->data);

    }

    FREE_LIST(int_list, dlink, list);

    printf("\n");

    }

    typedef struct string_list

    {

    struct list_head list;

    char *data;

    } string_list, *pstring_list;

    void test_string_list()

    {

    char * strings[] = {

    "我们",

    "都是",

    "**",

    "人"

    };

    struct string_list *dlink, *newnode, *posnode;

    struct list_head *pos;

    int i, length;

    length = sizeof(strings) / sizeof(char *);

    NEW_LIST_NODE(string_list, dlink);

    INIT_LIST_HEAD(&dlink->list);

    for (i = 0; i < length; i++)

    {

    NEW_LIST_NODE(string_list, newnode);

    newnode->data = strings[i];

    list_add(&newnode->list, &dlink->list);

    }

    list_for_each(pos, &dlink->list) {

    posnode = list_entry(pos, string_list, list);

    printf("%s ", posnode->data);

    }

    FREE_LIST(string_list, dlink, list);

    printf("\n");

    }

    int main()

    {

    test_int_list();

    test_string_list();

    }

主题

好友

10

积分

禁止访问

发表于 2010-4-10 05:27:19 |显示全部楼层
inflatable - inflatable bouncer, inflatable castles...
inflatable - inflatable bouncer, inflatable castles, inflatable slides, inflatable funland, inflatable tunnels, inflatable sports, inflatable obstacles, ...
LuoYangXinGuang Inflatable Toy Factory
Address:             NO.53, ChunDou Road ,LuoYang City, HeNan Province, China
Telphone:            86-379-62323635  86-379-62383173  86-15896663325 86-15038503988
FAX:                 86-379-62383002
http://www.inflatable-products.com
回复

使用道具 举报

主题

好友

44

积分

新手上路

发表于 2010-6-24 07:13:48 |显示全部楼层
糖的坏处还真是多:使人容易胖、破坏皮肤、破坏关节组织……但是很多人喝咖啡没了它,就会很痛苦。在科技如此发达的今天,甜和健康当然可以兼得。现在大型超市都可以买到无糖糖,较广泛使用的是阿斯巴甜(aspartame),它使用方便,小药片大小的一粒,就可以达到雪泡瘦效果的甜度,却仅含不到1卡路里(4.184千焦)的热量,还不快试试?中国饮食博大精深,但是餐馆里的中餐往往油大盐多。其实你还有别的选择,试试营养、美味且热量低的两款异国美食吧:韩国蔬菜拌饭和全麦三明治。韩国蔬菜拌饭与传统石锅拌饭的区别就是,雪泡瘦有用吗没有肉,蔬菜的量却很大,且多是未经焯煮的,营养成分得以最大限度的保留,但是不要怀疑它的味道,韩国辣酱、米饭、海苔、鸡蛋与蔬菜们一拌,一样是相当美味。全麦三明治也是不错的选择,高纤维的全麦面包,加上高钙的芝士、低脂火腿、大量且多样的蔬菜,营养相当均衡,记得不要选择雪泡瘦效果怎么样高热量的蛋黄酱、沙拉酱,选择芥末酱吧,热量低,也为三明治平添了更丰富的味觉感受。减肥的一个主要任务就是要为吃东西创造障碍,让食物进入肠胃前困难重重。面包,蛋糕味道甜美,口感也极为友好,但热量非常可观。大杏仁等坚果不失为很好的下午茶食品,但这里我们要提高雪泡瘦官网的级别,用需要进一步劳动才能吃到口的未去壳的开心果和山核桃来替代去壳的。有了劳动的过程,就可以大大减少进食量了,还活动了手指,开发了大脑,何乐而不为呢。
回复

使用道具 举报

主题

好友

3712

积分

论坛元老

发表于 2013-1-6 18:12:58 |显示全部楼层
号有深度的帖子啊
回复

使用道具 举报

主题

好友

1108

积分

金牌会员

发表于 2013-1-26 20:57:08 |显示全部楼层
没整理 一般人看不懂
回复

使用道具 举报

快速发帖

您需要登录后才可以回帖 登录 | 注册会员

手机版|Archiver|WPE|52wpe|我爱WPE ( 闽ICP备15009081号 )

GMT+8, 2024-4-26 06:47 , Processed in 0.059797 second(s), 16 queries .

返回顶部