feat: 添加 list 实现与测试,添加 stack 测试

This commit is contained in:
2024-07-28 14:53:08 +08:00
parent 8a80b3f8b9
commit d305d58e50
9 changed files with 186 additions and 43 deletions

21
tests/test-stack.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include <iostream>
#include <stack>
int main(int argc, char **argv)
{
std::stack<int> stack;
stack.push(1);
stack.push(2);
stack.push(3);
std::cout << "Current stack size: "<< stack.size() << std::endl;
std::cout << "Stack is empty? "<< stack.empty() << std::endl;
while (!stack.empty())
{
std::cout << stack.top() << " ";
stack.pop();
}
std::cout << std::endl;
// system("pause");
return 0;
}