int main() {
    SetOfStacks test;
    for(int i=1; i<=3*MAX; ++i) test.push(i);
    for (int i=0; i<MAX; ++i) {
        test.popAt(0);
        test.popAt(1);
    }
    test.popAt(3);
    while (!test.isEmpty()) {
        cout<<test.top()<<endl;
        test.pop();
    }
}
Exemple #2
0
int main()
{
	SetOfStacks stacks;
	for(int i = 0; i < 10; i++)
	{
		cout<<"SetOfStacks.push("<<i<<");"<<endl;
		stacks.push(i);
	}
	while(!stacks.empty())
	{
		cout<<"SetOfStacks.pop() = "<<stacks.pop()<< ";"<<endl;
	}

	for(int i = 0; i < 10; i++)
	{
		cout<<"SetOfStacks.push("<<i<<");"<<endl;
		stacks.push(i);
	}
	while(!stacks.empty())
	{
		cout<<"SetOfStacks.popAt(" <<0 <<") = "<< stacks.popAt(0)<< ";"<<endl;
	}
	getchar();
}