Facade设计模式主要作用是因为有个很难使用的类,然后要设计一个新类,整理好这个类,使得其更好使用。
比如有类如此:
class MessyClass
{
char *name;
public:
MessyClass() : name(new char[3])
{
for (int i = 0; i < 3; i++)
{
name[i] = ' ';
}
}
...
分类:
其他好文 时间:
2014-06-20 13:11:10
阅读次数:
232
上学期数据结构课上写的一个二叉树类,贴出来,写得不是太好,欢迎高手指点。
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
1 字符编码1.1编码的历史1.1.1ASCII码0=127 7位表示1.1.2ASCII扩展码0—255 8为表示。代码页:通过代码也来切换对应的字符(数字表示)1.1.3双字节字符集DBCS使用一个或两个字节表示字符。1.1.4Unicode编码全部使用2个字节表示字符内存 硬盘等资源占用变大。对编码支持度大。字符集1.2C 语言和编码1.2.1单字节的字符和字符串Char cText ...
不要让main函数返回void
//在C++中绝对没有出现过 void main(){ }这样的函数定义,在C语言中也是。
//两种 main 的定义方式:int main( void );
// int main( int argc, char** argv )
//第一版的C语言中只有
int 一种数据类型,为了兼容
需要,不明确标明...
分类:
其他好文 时间:
2014-06-20 09:49:05
阅读次数:
207
1 #include 2 #include 3 using namespace std; 4 5
#define N 4 6 7 void fullarrange(char num[], int len, int index) { 8 if(index ==
len) { 9 ...
分类:
其他好文 时间:
2014-06-20 08:51:28
阅读次数:
293
1.点击程序图标,打开程序2.执行main函数,分析如下:int main(int argc,
char * argv[]){ @autoreleasepool { /* argc: 系统或者用户传入的参数个数 argv: 系统或者用户传入的实际参...
分类:
移动开发 时间:
2014-06-11 13:26:09
阅读次数:
239
typedef unsigned char* byte_pointer;
void show_bytes(byte_pointer start, int len)
{
for (int i = 0; i
{
printf("%2x", start[i]);
}
cout
}
int _tmain(int argc, _TCHAR* argv[])
{
char* b...
分类:
其他好文 时间:
2014-06-07 16:22:02
阅读次数:
312
在上文介绍了C中文件操作的一些基本函数,下面给一个简单例子,完成从控制台输入一段字符串,然后将其写入文件,然后从文件中读出刚刚写入的内容,代码如下:
#include
#include
#include
const int LENGTH=80;
int main(void){
char mystr[LENGTH];
int lstr=0;
int mychar=0;
...
分类:
其他好文 时间:
2014-06-07 15:32:08
阅读次数:
186
package test;
public class NumberFormatTest {
static String[] units = { "", "十", "百", "千", "万", "十万", "百万", "千万", "亿",
"十亿", "百亿", "千亿", "万亿" };
static char[] numArray = { '零', '一', '二', '...
分类:
编程语言 时间:
2014-06-07 13:15:10
阅读次数:
230
关于结构体的一个特殊用法
//写法一
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