随笔分类 - C++
摘要:C++设计与实现关系数据库ORM系统,实现Json到SQL的生成,支持sqlite3,mysql,postres三种最流行的关系数据。使用cmake进行项目管理,实现跨平台,同时支持window,linux 和 macos。
阅读全文
摘要:设计思路设计一个类,根结点只可读取,具备构造二叉树、插入结点、删除结点、查找、 查找最大值、查找最小值、查找指定结点的前驱和后继等功能接口。二叉排序树概念它或者是一棵空树;或者是具有下列性质的二叉树:(1)若左子树不空,则左子树上所有结点的值均小于它的根结点的值;(2)若右子树不空,则右子树上所有结...
阅读全文
摘要:View Code typedef int DataType;struct Node{ DataType entry; Node * next; Node(); Node(DataType item, Node * add_on = NULL);};class DyStack{public: DyStack(); bool empty() const; ErrorCode push(const DataType &item); ErrorCode pop(); ErrorCode top(DataType &item) const; ...
阅读全文
摘要:C++队列的循环实现:View Code const int MAXQUEUE = 10;template<class T>class ZtkQueue {public: ZtkQueue(); bool empty() const; ErrorCode append(const T &x); ErrorCode serve(); ErrorCode retrieve (T &x)const; bool full() const; int size() const; void clear(); ErrorCode serve_and_ret...
阅读全文
摘要:用顺序结构(数组)与模板技术实现Stack如下:View Code const int MAXSTACK = 10;template<class T>class ZtkStack{public: ZtkStack(); bool empty() const; ErrorCode pop(); ErrorCode top(T &item) const; ErrorCode push(const T &item);private: int count; T entry[MAXSTACK];};template<class T>ZtkStack<T>
阅读全文
摘要:1、建立Win32控制台空项目;2、项目属性默认使用Unicode库,我们要关闭它,Alt+F7/Character Set/Not Set;3、添加源文件C++ File(.cpp); 最简单的示例代码:#include<iostream>int main(){ std::cout << "This is a test program!" << std::endl; std::getchar(); return 0;}注:这是使用VS2012编写标准C++代码(ISO/IEC C++),可移植性最好的方法。
阅读全文