摘要:
1 #ifndef _RBTREE_H_ 2 #define _RBTREE_H_ 3 4 const int nodeSize = 3; 5 class RBTree 6 { 7 private: 8 typedef struct Node { 9 int key; 10 int color; / 阅读全文
摘要:
1 #ifndef _TREE_H_ 2 #define _TREE_H_ 3 //此类用shared_ptr来管理节点内存,所以要包含<memory>头文件,不需要手动释放内存 4 #include <memory> 5 #include <iostream> 6 7 using namespac 阅读全文
摘要:
1 #ifndef _BLIST_H_ 2 #define _BLIST_H_ 3 4 #include <iostream> 5 6 using namespace std; 7 8 template<class T> 9 class List{ 10 11 private: 12 class N 阅读全文
摘要:
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef int DataType; 5 6 //比较器 7 int mycmp(const void * a, const void *b); 8 9 //int (*compar)(const v 阅读全文
摘要:
自己用C写的list双向链表头文件 1 #ifndef _LIST_H_ 2 #define _LIST_H_ 3 4 #include <stdlib.h> 5 #include <stdio.h> 6 #include <stdbool.h> 7 8 typedef int DataType; 阅读全文
摘要:
#ifndef CALENDAR_H_ #define CALENDAR_H_ #include <string> #include <iostream> #include <stdio.h> void showCalendar(int year, int month); void showHead 阅读全文
摘要:
基于C的文件操作 在ANSI C中,对文件的操作分为两种方式,即流式文件操作和I/O文件操作,下面就分别介绍之。一、流式文件操作这种方式的文件操作有一个重要的结构FILE,FILE在头文件stdio.h中定义如下:typedef struct {int level; /* fill/empty le 阅读全文
摘要:
fread(buf,size,nmemb,fp): 从fp中将nmemb个size字节的内容读入到buf缓冲区中。如果没遇到文件结尾,其返回值应等于nmemb,否则返回实际读取的大小。 fwrite(buf,size,nmemb,fp); 将buf缓冲区中读取的nmemb个size字节的内容写入fp 阅读全文
摘要:
随机存取:fseek(),ftell() fseek(fp,offset,pos): 文件指针定位,fp指向被打开的文件,offset为相对当前pos位置的偏移量,正数表示 向文件尾部偏移,负数表示向文件头部偏移。pos有三种状态, 分别为SEEK_SET(0)文件开始;SEEK_CUR(1)当前位 阅读全文
摘要:
方法一:文件指针固定,依靠偏移量来访问文件内容 方法二: 偏移量固定,依靠SEEK_CUR当前指针来访问文件内容 阅读全文