03 2014 档案
摘要:1 #include "stdio.h" 2 #include "stdlib.h" 3 4 // 程序员有三种行为:吃饭,睡觉,写代码。 5 // 程序员有两种状态:生病,健康 6 class Status 7 { 8 public: 9 virtual void eat() = 0; 10 virtual void sleep() = 0; 11 virtual void writeCode() = 0; 12 }; 13 14 // 生病状态 15 class IllStatus :public Status 16 { 17 public:...
阅读全文
摘要:1 -- lua链表的实现 2 3 node = {} 4 list = node 5 6 --初始化,构建一个空表 7 function init() 8 list.data = 0 --我将头结点的数据域存放链表的长度,以免浪费空间 9 list.next = nil 10 end 11 12 --向链表的尾部添加数据 13 function addRear(d) 14 node.next={}--建立一个节点,相当于malloc一个节点 15 node = node.next 16 node.next = nil 17 ...
阅读全文