主页
C++
C++ 栈
demo_stack_remove
运行 ❯
×
更改方向
保存代码
更改主题
#include
#include
using namespace std; int main() { // Create a stack of strings called cars stack
cars; // Add elements to the stack cars.push("Volvo"); cars.push("BMW"); cars.push("Ford"); cars.push("Mazda"); // Remove the last/latest added element (Mazda) cars.pop(); // Access the top element (Now Ford) cout << cars.top(); return 0; }
Ford