C++ Template Stack User
#include <iostream> #include <string> #include "stackt2.h" using namespace std; main() { // Make a stack of integers. Stack<int, 30> is; int n; cout << "Enter integers to -1:" << endl << "> "; while(cin >> n) { if(n == -1) break; is.push(n); cout << "> "; } while(!is.empty()) cout << is.pop() << " "; cout << endl; // Make a stack of strings. Stack<string> ss; string s; cout << "Enter lines to EOF:" << endl << "> "; cin.clear(); getline(cin,s); while(getline(cin,s)) { ss.push(s); cout << "> "; } cout << endl; while(!ss.empty()) cout << ss.pop() << endl; }