#include "int_stack.h" #include istack::istack(int capacity) { values = new int[capacity]; this->capacity = capacity; top = -1; } int istack::push(int value) { return values[++top] = value; } int istack::pop() { return values[top--]; } bool istack::empty() { return top < 0; } bool istack::full() { return top >= capacity - 1; } /* int main() { int i; istack s1(5), s2(5); for (i = 0; !s1.full(); i++) { s1.push(2 * s2.push(i)); } while (!s1.empty()) { printf("%d\n", s1.pop()); } while (!s2.empty()) { printf("%d\n", s2.pop()); } return 0; } */