Life Sucks
Cadet 2nd Year
- Registriert
- Juli 2018
- Beiträge
- 29
C++:
#pragma once
#include <string>
class FixedCapacityOfStack
{
private:
std::string* k;
int N;
public:
FixedCapacityOfStack(int capacity)
{
k = new std::string[capacity];
N = 0;
}
bool isEmpty() { return N == 0; }
bool isFull()
{
//int m = sizeof(k);
//if (m == N)
//return true;
}
void push(std::string item) { k[N++] = item; }
std::string pop() { return k[--N]; }
};
Hallo,
also ich bin auf der Suche nach einer Methode zum überprüfen, ob der Stack voll ist. Ich hab einen Ansatz aber er funktioniert nicht. Er gibt nur aus, wie viele Elemente drinnen sind. Ich möchte irgendwie die Kapazität mit
C++:
N