Develop a class implementing the classic Stack datastructure
containing integer values. That is, it should support the following
operations:
-
Push(value) - adds a value to top of the stack -
value Pop() - removes the top element of the stack and returns
that value -
int Count() - returns the current number of elements contained
in the stack Comment by Jeff: Demonstrates technique well but
solution is a bit too trivial, which can shortchange the value of TDD
|
|
Jeff@
Agreed but I think this site should have both easy and harder problems
Hi Olaf--I agree, I don't think we should edit any of them out. My notion was to add notes on positive/negative experiences in using these as bases for TDD demos.
aha. I see. this comment area is good to have. it would be even better if anonymous users (with moderation to avoid spam) would be possible..