摘要: /**************************************************************** Name: StuManaMain.cpp* Purpose: Code for Application Frame* Author: Zhangaihua (... 阅读全文
posted @ 2014-05-29 20:29 ZhangAihua 阅读(797) 评论(0) 推荐(0) 编辑
摘要: main.cxx#include "soci.h"#include "soci-sqlite3.h"using namespace soci; #include using namespace std;int main(){session sql;sql.open(sqlite3, "./stu.d... 阅读全文
posted @ 2014-05-27 16:55 ZhangAihua 阅读(406) 评论(0) 推荐(0) 编辑
摘要: main.cxx#include #include #include #include using namespace std; int main() { sqlite3* file; int flag; flag = sqlite3_open("./stu.db", &file); if(... 阅读全文
posted @ 2014-05-27 16:52 ZhangAihua 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 以下是学生公寓信息管理的增加和删除,仅供参考。。void StuManaFrame::OnAdd(wxCommandEvent &event){ //add student's dormitory infomation sqlite3 *db=NULL;int flag; char *errms... 阅读全文
posted @ 2014-05-27 16:51 ZhangAihua 阅读(257) 评论(0) 推荐(0) 编辑
摘要: /*************************************************************** * Name: CaculatorMain.h * Purpose: Defines Application Frame * Author: zhangaihua (62... 阅读全文
posted @ 2014-05-22 09:57 ZhangAihua 阅读(679) 评论(0) 推荐(0) 编辑
摘要: 判断单链表是否有环两个指针分别为p1和p2,每循环一次只向前走一步,p2向前走两步,知道p2碰到NULL指针或者两个指针相等则说明有环如果存在,start存放在圆环开始的节点bool IsLoop(node *head,node *start){node *p1=head,*p2=head;if(h... 阅读全文
posted @ 2014-05-09 11:33 ZhangAihua 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 例:已知两个单链表head1和head2各自有序升序排列,请把他们合并成一个连表并依然有序,并保留原来所有节点 假设以下两个链表: 链表1:1-3-5 链表2:2-4-6 (1)比较1和链表2的第一个节点数据,由于15)和链表2在调用本过程,比较得到结果链表的第二个节点,即2与3比较得到2,此时合并后的链表节点为1-2,这样 递归知道两个链表的节点都被加到结果链表中。 阅读全文
posted @ 2014-05-09 10:54 ZhangAihua 阅读(681) 评论(0) 推荐(0) 编辑
摘要: 将单链表逆序单链表的逆置遍历一遍单链表,利用一个辅助指针存储遍历过程中当前指针指向下一个元素,然后将当前元素的指针反转,利用已经存储的指针往后继续遍历node *reverse(node *head){node *p,*q,*r;if(head->next==NULL)//链表为空{return head;}p=head->next;q=p->next;//保存原第二个节点p->next=NULL;//原第一个节点为末节点while(q!=NULL)//遍历各个节点的next指针反转{r=q->next;q->next=p;p=q;q=r;}head-> 阅读全文
posted @ 2014-05-08 21:26 ZhangAihua 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 单链表节点的删除删除单链表pos位置的节点,返回头指针pos从开始计算,1表示删除head后面的第一个节点node *delete_node(node *head,int pos){node *item=NULL;node *p=head->next;if(p==NULL){printf("link is empty\n");return NULL;}p=search_node(head,pos-1);//获得位置pos的节点指针if(p!=NULL && p->next!=NULL){item=p-... 阅读全文
posted @ 2014-05-08 21:13 ZhangAihua 阅读(715) 评论(0) 推荐(0) 编辑
摘要: 单链表节点的插入在单链表中某位置(pos个节点)后面插入节点1.插入到链表首部2.插入到链表中间3.插入到蓝标尾部单链表某个位置插入节点,返回链头指针,pos从0开始计算,0表示插入到head节点后面node *insert_node(node *head,int pos,int data){node *item=NULL;node *p;item=(node *)(sizeof(node));item->data=data;if(pos==0)//插入到链表头后面{head->next=item;return head;}p=search_node(he... 阅读全文
posted @ 2014-05-08 21:02 ZhangAihua 阅读(682) 评论(0) 推荐(0) 编辑