#include "stdlib.h" #include "string.h" #include "stream.h" class Stack { int _s; int* _top; public: Stack() { _top = new int[100]; _s = 0; } void push(int x) { *_top = x; _top++; if (x/2*2 == x) { *_top = x; _top++; } } void pop() { _s++; } void print() { _top--; for(int i = 0; i < _s; i++) { cout << *_top << '\n'; _top--; } } }; void main() { Stack aStack; char data[8]; strcpy(data,"9819049"); /***/ for (int i=0; i<7; i++) { aStack.push(data[i]-'0'); aStack.pop(); } aStack.print(); }