Пример #1
0
int main(int, char **)
{
	cout << "IntStack:" << endl;
	IntStack stack;

	cout << "Empty: " << stack.IsEmpty() << endl;
	stack.Push(10);
	cout << "Empty: " << stack.IsEmpty() << endl;
	int val = stack.Pop();
	cout << "Popped off: " << val << endl;
	cout << "Empty: " << stack.IsEmpty() << endl;

	cout << "IntPtrStack:" << endl;
	IntPtrStack stack2;
	int value = 42;

	cout << "Empty: " << stack2.IsEmpty() << endl;
	stack2.Push(&value);
	cout << "Empty: " << stack2.IsEmpty() << endl;
	int *valptr = stack2.Pop();
	cout << "Popped off: " << *valptr << endl;
	cout << "Empty: " << stack2.IsEmpty() << endl;

	return 0;
}