//请写一个栈的模板类,要求栈的长度可以动态改变。使用如下代码进行测试: int main() { //调用普通模版 int i; CStack<int> stInt; for (i = 1; i <= 20; i++) { stInt.Push(i); } cout << "调用CStack<int>普通模版, 元素个数为: " << stInt.Size() << endl; while (stInt.IsNotEmpty()) { int iData; stInt.Pop(iData); cout << iData << " "; } cout << endl << endl; ///* //调用特化模版 CStack<char *> stCharP; for (i = 1; i <= 15; i++) { char sz[10]; sprintf(sz, "s%d", i); stCharP.Push(sz); } cout << "调用CStack<char *>特化模版, 元素个数为: " << stCharP.Size() << endl; while (stCharP.IsNotEmpty()) { char * pData; stCharP.Pop(pData); cout << pData << " "; } cout << endl << endl; //*/ //返回 system("pause"); return 0; }