房收费系统的时候,令人相当恶心的一件事就是判断文本框和组合框是否为空还有清空文本框。基本上每个窗体都要进行判断,那一个接着一个的If...Else...语句,长长一串,看着就头疼,但是第一次做机房收费系统的时候竟然傻傻的一个不落都写了出来。真佩服当时的自己,不过这一次还是不要在做那种傻事了,因为我们经历了不少面向对象的洗礼,认识了封装。
向对象的范畴里,对于相同的或者类似的代码...
分类:
Web程序 时间:
2014-06-20 13:13:04
阅读次数:
427
上学期数据结构课上写的一个二叉树类,贴出来,写得不是太好,欢迎高手指点。
struct BiNode//定义节点类型
{
char data;
BiNode *lchild;
BiNode *rchild;
};
class BiTree
{
private:
BiNode *root;
public:
BiTree()
{
root=NULL;
}
~BiT...
分类:
其他好文 时间:
2014-06-20 11:19:10
阅读次数:
193
Enumerations and Structures
Enumerations 枚举的使用
使用 enum 定义一个枚举,枚举里面可以关联方法,比如下文中的描述方法
enum Rank: Int {
case Ace = 1
case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten
case Ja...
分类:
其他好文 时间:
2014-06-20 09:03:39
阅读次数:
322
#include#include#define MAX_VERTEX_NUM 20 typedef
struct ArcBox{ int tailvex,headvex;//该弧的头和尾定点的位置 struct ArcBox
*hlink,*tlink;//分别为弧头和弧尾相同的弧的链域 int *...
分类:
其他好文 时间:
2014-06-12 00:13:49
阅读次数:
243
并查集+拓扑排序。使用并查集解决a = b的情况。 1 #include 2 #include 3
#include 4 #include 5 using namespace std; 6 7 #define MAXN 10005 8 9 typedef
struct ...
分类:
其他好文 时间:
2014-06-11 21:54:30
阅读次数:
284
有的时候需要用python处理二进制数据,比如,存取文件,socket操作时.这时候,可以使用python的struct模块来完成.可以用
struct来处理c语言中的结构体.struct模块中最重要的三个函数是pack(), unpack(), calcsize()pack(fmt, v1,
v2...
分类:
编程语言 时间:
2014-06-11 13:23:29
阅读次数:
325
【题目】
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be...
分类:
其他好文 时间:
2014-06-07 14:28:36
阅读次数:
215
关于结构体的一个特殊用法
//写法一
struct array {
int count;
char *buf;
}
//写法二
struct array {
int count;
char buf[0];
}
如果一个buf用作一个buffer的话,这时候如果malloc一块内存,
用方法一,buf是指针的话,指向这块申请出的内存的话,这里arr...
分类:
其他好文 时间:
2014-06-07 12:13:20
阅读次数:
273
题目链接判断一颗二叉树是否是二叉搜索树(二叉排序树),也就是BST如果该二叉树是BST, 那么对其中序遍历,所得序列一定是单调递增的(不考虑有重复数值的情况)附上代码:
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 *...
分类:
其他好文 时间:
2014-06-07 11:28:18
阅读次数:
254
从sdk3.2.5升级到sdk
7.1中间废弃了很多的方法,还有一些逻辑关系更加严谨了。1,警告:“xoxoxoxo” is
deprecated解决办法:查看xoxoxoxo的这个方法的文档,替换掉这个方法即可。2,警告:Declaration of "struct
sockaddr" will ...
分类:
其他好文 时间:
2014-06-07 07:43:40
阅读次数:
204