正在加载图片...
49// push element onto stack 50// if successful, return true; otherwise, return false Outline 51 template< typename t> 52 bool stack< T >: push( const T &pushvalue 53{ if ( IisFul1O) Stack. h 456789 stackPtr[ ++top ] pushValue; // place item on stack return true;// push successful (3of3) b// end if 60 return false;// push unsuccessful 613// end function template push 63// pop element off stack; template<类型形参表> 64// if successful, return true; otherwise, return false 函数返回类型类模板名<类 65 template< typename t >t 型名表>:成员函数(形参) 66 bool stack< T >: pop( T &popvalue 68if〔! isEmptyo) popvalue stackPtr[ top--]:// remove item from Stack return true;// pop successful end 1 74 return false;// pop unsuccessful 75 3// end function template pop 77 #endif 0 2018, SEU. All rights reserved. 27© 2009, SEU. All rights reserved. © 2018, SEU. All rights reserved. 27 Outline Stack.h (3 of 3) 48 49 // push element onto Stack; 50 // if successful, return true; otherwise, return false 51 template< typename T > 52 bool Stack< T >::push( const T &pushValue ) 53 { 54 if ( !isFull() ) 55 { 56 stackPtr[ ++top ] = pushValue; // place item on Stack 57 return true; // push successful 58 } // end if 59 60 return false; // push unsuccessful 61 } // end function template push 62 63 // pop element off Stack; 64 // if successful, return true; otherwise, return false 65 template< typename T > 66 bool Stack< T >::pop( T &popValue ) 67 { 68 if ( !isEmpty() ) 69 { 70 popValue = stackPtr[ top-- ]; // remove item from Stack 71 return true; // pop successful 72 } // end if 73 74 return false; // pop unsuccessful 75 } // end function template pop 76 77 #endif template <类型形参表> 函数返回类型类模板名<类 型名表>::成员函数(形参)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有