Example #1
0
int main(int argc, char* argv[])
{
	CStack s;
	int i = 0, t;
	while(i < 10)
		s.push(i++);
	i = 0;
	while(s.pop(t))
	{
		if(s.isEmpty() == true)
			break;
		cout << t << endl;
	}

	return 0;
}
Example #2
0
int main()
{
	CStack stack; // Default constructor is called.  Our stack will be 
				 // kDefaultStackSize (10) elements large.

	// Let's push some integers (0, 1, 2, 3, 4) on the stack
	for(int i = 0; i < 5; i++)
		stack.push(i);

	// Now lets pop all the elements off of the stack printing each one 
	// as they come off
	while(stack.isEmpty() == false)
	{
		cout << "Top = " << stack.getTop() << endl;
		stack.pop();
	}
	
	return EXIT_SUCCESS;

} // end of main()