testprogstack.cpp
来自「data+structures+using+c的源码」· C++ 代码 · 共 36 行
CPP
36 行
//Program to test the various operations of a stack
#include <iostream>
#include "myStack.h"
using namespace std;
int main()
{
stackType<int> intStack(50);
stackType<int> tempStack;
intStack.push(23);
intStack.push(45);
intStack.push(38);
tempStack = intStack; //copy intStack into copyStack
cout<<"tempStack elements: ";
while(!tempStack.isEmptyStack()) //print copyStack
{
cout<<tempStack.top()<<" ";
tempStack.pop();
}
cout<<endl;
cout<<"The top element of intStack: "<<intStack.top()<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?