IMO, a lot of your code doesn't really need comments. If one chooses meaningful names for variables and functions, then the code itself tells a story of what is happening - so well done there :+)
Comments can be handy to explain
why something is being done; invariants; expected ranges of values; pre and post conditions.
Btw, there has never been a requirement in C++ for void as function parameter, just leave it empty.
This looks a bit sketchy -
Does it work? I see it throws when the end is reached, that's not a good use for an exception.
151 152 153 154
|
while (true)
{
cout << MyStack.Pop() << " ";
}
|
I am not keen on infinite loops with no obvious exit in the code.
Ideally, one would define iterators, then use a range based for loop to do things like print all the elements.
The
catch
clauses are pointless at the moment, at least print what the error is.
Good Luck !!