09 2012 档案
摘要://为二维数组开辟空间 int **p = new int*[num1]; for(int i=0; i <num1; ++i) p[i] = new int[num2]; //释放二维数组占用的空间 for(int m=0;m <num1;m++) delete[] p[m]; delete[] p;注意以下几个等价式:int **c; c = new int*[3]; for( i=0;i <3;i++) { c[i] = new int[4]; } //c[5][3]和下面等价用法:int **c;c = (int **)...
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 4 void QuickSort(int a[],int first,int last) 5 { 6 if(first==last) 7 return; 8 int i=first,j=last; 9 int tmp;10 tmp=(a[first]+a[last])/2;11 while(i!=j)12 {13 while((i<j)&&(a[i]<tmp)) 14 i++;15 ...
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 4 struct ListNode 5 { 6 int num; 7 char name[20]; 8 ListNode *link; 9 }; 10 11 ListNode *first,*last; 12 13 void Create()//建立一个链表 14 { 15 ListNode *p,*q; 16 int i; 17 q=first;//新节点要把节点设为空 18 while(1) 19 { 20 ...
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 4 struct ListNode 5 { 6 int num; 7 char name[20]; 8 ListNode *link; 9 }; 10 11 ListNode *first,*last; 12 13 void Create()//建立一个链表 14 { 15 ListNode *p,*q; 16 int i; 17 q=first;//新节点要把节点设为空 18 while(1) 19 { 20 ...
阅读全文
摘要:1 #include<iostream> 2 #include<string> 3 #include<stdlib.h> 4 #include<assert.h> 5 using namespace std; 6 7 class String{ 8 private: 9 char *str; 10 int size; 11 public: 12 String(char *s); 13 ~String(); 14 String operator+(String& s); 15 String operator=(String& ...
阅读全文
浙公网安备 33010602011771号