-
Creating a stack
I am supposed to make a program that allows one to type a string of letters and then output them in reverse. You simply put each letter into the stack then pull them back out in reverse. However, I do not know how to make a stack >.< It isn't in the book and it's driving me mad. It's supposed to be linklist-related, and it has a "push, pop", and "onTop" function. Heelllp!
The only example they give:
Code:
EXAMPLE OF A STACK:
stack<int> s;
s.push(4);
s.push(10);
s.push(12);
item = s.pop();
s.push(3 * item);
item = s.onTop();
s.push(3 * item);
-
This question has been answered before. Go to a seach engine and look it up!
-
well i have implemented one in C++ (classes..) want to have a look..
-
-
This question has been answered before, and I've posted a full (naive) implementation at least once or twice.
-Prelude