//testmyq4.cpp -- using class queue in STL // CopyLeft by tsaiwn@csie.nctu.edu.tw #define enque push #define top front // 以下的 #ifndef 是用來 check 是否為 GNU 的 g++ ? // 若不是則使用舊式的寫法! 例如 Turbo C++ 3.0 只認識舊式的寫法! #ifndef __GNUG__ #include #include #else #include #include using namespace std; #endif ////// ////// ////// ////// ////// ////// int main( ) { queue xo; // queue is a template class in STL xo.enque(53); xo.push(770); xo.push(880); while(!xo.empty( ) ) { cout << xo.top( ) << " "; xo.pop( ); } cout << endl; // new line return 0; }