Beispiel #1
0
int main()
{
	SetOfStacks<int> *piStk = new SetOfStacks<int>();
	int iArr[] = {11, 3, 5, 2, 9, 10, 1, 20, 22, 23, 15, 16, 13, 10, 1, 41};
	for(int i = 0; i < sizeof(iArr) / sizeof(int); i++)
		piStk->Push(iArr[i]);

	cout << "Pop from No 2 stack: " << piStk->PopAt(1) << endl;
	cout << "Pop from No 3 stack: " << piStk->PopAt(2) << endl;
	piStk->PrintStack();

	system("pause");
	return 0;
}
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();
    }
}
Beispiel #3
0
int main()
{
    SetOfStacks mystack;
    for(int i=0;i<31;i++)
        mystack.push(i);
    mystack.PopAt(1);
    while(!mystack.isempty())
    {
        cout<<mystack.findtop()<<endl;
        mystack.pop();
    }
    return 0;
}
int main(){
	Stack.push(5);
	Stack.push(2);
	Stack.push(3);
	Stack.push(7);
	Stack.pop();
	Stack.pop();
	Stack.pop();
	Stack.push(10);
	cout << Stack.top() << endl;
	system("pause");
	return 0;
	
}
Beispiel #5
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();
}
int main()
{
	SetOfStacks<int> myStackSet;
	myStackSet.push(3);
	myStackSet.push(4);
	myStackSet.push(5);
	cout<<myStackSet.getStackNum()<<endl;
	myStackSet.push(6);
	myStackSet.push(8);
	myStackSet.push(9);
	cout<<myStackSet.getStackNum()<<endl;
	myStackSet.push(0);
	cout<<myStackSet.getStackNum()<<endl;
	myStackSet.pop();
	cout<<myStackSet.getStackNum()<<endl;
	myStackSet.pop();
	myStackSet.pop();
	myStackSet.pop();
	myStackSet.pop();
	myStackSet.pop();
	cout<<myStackSet.getStackNum()<<endl;
	myStackSet.pop();
	return 0;
}