stack characters

Is there a way to stack multiple characters?

Example:

// stack::top
#include <iostream>
#include <stack>
using namespace std;

int main ()
{
stack<char> mystack;
mystack.push('abc'); <---- stack only allows 1 character
cout << "mystack.top() is now " << mystack.top << endl;
system ("PAUSE");
return 0;
}

Any answers would be appreciated.




you could do something like this:

1
2
3
string characters = "abc";
for (int i = 0; i < characters.length(); ++i)
  mystack.push(characters.at(i));


~psault
Topic archived. No new replies allowed.