随笔分类 - C++_STL
摘要:由于在C++数据结构中的代码不完整,特补全。等日后当工程库调用。若有疑问,请留言.#includeusing namespace std;templatestruct Node{ T data; Node *next;};template class LinkStack{private: Node *top;public: LinkStack(){top=NULL;} ~LinkStack(); void Push(T x); void Pop(); T GetTop(); int StackEmpty(); void ClearSt...
阅读全文
摘要:清华大学出版的《数据结构》真坑。什么变量没定义,什么模版引用错了。总之,有太多相同的错了 但是我还是纠正过来了。 1 //LinkList.h 2 template <class T> 3 struct Node 4 { 5 T data; 6 Node<T> *next; 7 }; 8 9 tem
阅读全文
摘要:1 #include<stdio.h> 2 #include<typeinfo.h> 3 4 template <class T1,class T2> 5 class A{ 6 T1 i; 7 T2 j; 8 public: 9 A(T1 t1,T2 t2){i=t1;j=t2;} 10 bool
阅读全文
摘要:templateT max(T a,T b){ return a>b?a:b;}
阅读全文
摘要:1 #include<algorithm> 2 #include<iostream> 3 using namespace std; 4 void print(int x) 5 { 6 cout<<x<<' '; 7 } 8 int main() 9 { 10 int iArray[]={2,8,-1
阅读全文

浙公网安备 33010602011771号