//DISPLAY 18.10 Program Using the Stack Template Class //Program to demonstrate use of the stack template class from the STL. #include #include using std::cin; using std::cout; using std::endl; using std::stack; int main( ) { stack s; cout << "Enter a line of text:\n"; char next; cin.get(next); while (next != '\n') { s.push(next); cin.get(next); } cout << "Written backward that is:\n"; while ( ! s.empty( ) ) { cout << s.top( ); s.pop( ); } cout << endl; return 0; }