摘要: 链表合并先,将两个链表排序,在合并的时候引入一个内存泄露的问题,之后会继续讨论。#include <ctime>#include <cstdlib>#include <iostream>#include <cstdio>using namespace std;#define NN#define RANGE 100#define NUM 10struct node{int value;node * next;node(int v = -1, node *nxt = NULL) : value(v),next(nxt){}};node * make_ 阅读全文
posted @ 2012-05-18 22:47 KingsLanding 阅读(2992) 评论(0) 推荐(0) 编辑
摘要: 就直接贴代码了:#include <iostream>#include <ctime>#include <cstdlib>using namespace std;#define NN 1struct node{int value;node * next;node(int v = -1, node *nxt = NULL) : value(v),next(nxt){}};node* reverse(node * ); //直接使用 node 代表这个结构体node * make_link();void display(node *);int main(){no 阅读全文
posted @ 2012-05-18 22:37 KingsLanding 阅读(229) 评论(0) 推荐(0) 编辑
摘要: C++用 ifstream 声明输入文件对象,用 ofstream 声明输出文件对象。getline的使用:(感觉有点像孔乙己的茴香豆的 茴 的写法了)#include<iostream>#include<fstream>#include<string>using namespace std;int main(){ ifstream infile("getline.txt",ios::in | ios::binary); char buf1_1[30]; string buf1; char buf2[30]; ///注意这里getline 阅读全文
posted @ 2012-05-18 20:14 KingsLanding 阅读(4103) 评论(0) 推荐(0) 编辑