正在加载图片...
const int size=10 Template<class Type> class stacki Type stck[size] Int tos. public void initoitos0;] void push (Type ch) Type popo } 成员函数push和pop在类定义体外定义为 template<class type> void stack<Type> push(Type ob) i if(tos==size) i cout<< stack is full return; stcktos]ob tos++const int size=10 Template<class Type> class stack{ Type stck[size]; Int tos; public: void init() {tos=0;} void push(Type ch); Type pop(); }; 成员函数 push() 和 pop() 在类定义体外定义为 template<class Type> void stack<Type>::push(Type ob) { if(tos= =size) { cout<<”stack is full”; return; } stck[tos]=ob; tos++; } 13
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有