/** Stack_1.cpp ** Created on: August 2, 2013 * Author: Huang Dongdong * constantly strives to have a girlfriend like Zhang Zetian ......... */# include <iostream> using namespace std; typedef int T; class Stack {T a [5]; int cur; public: Stack (): cur (0) {} void push (const T & d) {a [cur ++] = d;} T pop () {return a [-- cur];} const T & top () {return a [cur-1];} bool empty () {return cur = 0;} bool full () {return cur = 5;} int size () {return cur;} voi D clear () {cur = 0 ;}}; int main () {Stack s; s. push (6); s. push (7); s. push (8); s. push (9); s. push (10); while (! S. empty () {cout <s. pop () <endl ;}}/** stack_1.cpp ** Created on: August 2, 2013 * Author: huang Dongdong * constantly strives to have a girlfriend like Zhang Zetian ......... */# include <iostream> using namespace std; typedef int T; class Stack {T a [5]; int cur; public: Stack (): cur (0) {} void push (const T & d) {a [cur ++] = d;} T pop () {return a [-- cur];} const T & top () {return a [cur-1];} bool empty () {return cur = 0;} bool full () {return cur = 5;} int size () {return Cur ;}void clear () {cur = 0 ;}}; int main () {Stack s; s. push (6); s. push (7); s. push (8); s. push (9); s. push (10); while (! S. empty () {cout <s. pop () <endl ;}}