摘要: LinkList类View Code 1 //LinkList类 2 template<class Type>class LinkList 3 { 4 private: 5 struct Node 6 { 7 Node *Next; 8 Type data; 9 }*Head,*Tail;10 unsigned int size;11 public:12 LinkList()13 { 14 Head=new Node;15 Head->Next=NULL; 16 ... 阅读全文
posted @ 2012-02-26 11:37 landy聪 阅读(123) 评论(0) 推荐(0) 编辑
摘要: /*输入一个整数,如:整数7它的和为 N1+N2+...+Nk=7,且 N1>=N2>=..>=Nk(k>=1),将其拆分,并打印出各种拆分.对于7有: 6+1=7..5+2=7....1+1+1+1+1+1+1=7共有14种拆分方法。分解过程:输入3: (对5分解) 5=4+15=3+2(用递归对4分解) 4=3+14=2+2(用递归对3分解) 3=2+1(用递归对2分解) 2=1+1*/View Code 1 #include<iostream> 2 #include<list> 3 4 usingnamespace std; 5 6 int 阅读全文
posted @ 2011-03-29 16:17 landy聪 阅读(580) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<iostream> 2 #include<iomanip> 3 //#include"CheckMemoryLeak.h" 4 5 using namespace std; 6 7 void spiral(int n) 8 { 9 int temp=0; //记录层数10 int num=1; //填写数组值11 int i=0,j=0; //控制循环12 int x=0,y=-1; //控方向13 int **N=new int*[n]; //数组14 ... 阅读全文
posted @ 2011-03-09 22:37 landy聪 阅读(240) 评论(0) 推荐(0) 编辑