Matrix & Stack

This commit is contained in:
e2hang
2025-07-21 15:18:52 +08:00
5 changed files with 396 additions and 0 deletions

43
Stack/arrayStack/main.cpp Normal file
View File

@@ -0,0 +1,43 @@
#include <iostream>
#include "stack.h"
#include "arraystack.h"
using namespace std;
/*
TO TEST:
private:
T* stack;
int stackTop;
int length;
public:
arrayStack(int initialCapacity = 10);
virtual ~arrayStack() { delete[] stack; }
virtual bool empty() const override { return stackTop == -1; }
virtual int size() const override { return stackTop + 1; }
virtual T& top() override;
virtual void pop() override;
virtual void push(const T& theElement) override;
arrayStack& operator=(const arrayStack& x);
arrayStack(const arrayStack& x);
*/
int main(){
arrayStack<char> s(10);
s.push('a');
s.show();
s.push('b');
s.show();
s.push('c');
s.show();
s.pop();
s.show();
return 0;
}
/*
a
a b
a b c
a b
*/