Hi,
can anyone help me with my code? Im trying to reverse my string using stack... but when it compiles and put in a string and press enter... nothing happens...
Any suggestions?
#include <iostream>
#include<stack>
#include<string>
using namespace std;
int main()
{
stack <string> s;
string a;
cout << "Enter: " << endl;
while(getline(cin, a) && a != "\n")
{
s.push(a);
}
while(!s.empty())
{
cout << s.top();
s.pop();
}
cout << endl;
system("pause");
return 0;
}