home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C13 / Stack4Test.cpp < prev   
Encoding:
C/C++ Source or Header  |  2000-05-25  |  707 b   |  28 lines

  1. //: C13:Stack4Test.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. //{L} Stack4
  7. // Test new Stack
  8. #include "Stack4.h"
  9. #include "../require.h"
  10. #include <iostream>
  11. #include <fstream>
  12. #include <string>
  13. using namespace std;
  14.  
  15. int main() {
  16.   // Could also use command-line argument:
  17.   ifstream file("Stack4Test.cpp");
  18.   assure(file, " Stack4Test.cpp");
  19.   Stack textlines;
  20.   string line;
  21.   while(getline(file, line))
  22.     textlines.push(new string(line));
  23.   // Pop lines from the Stack and print them:
  24.   string* s;
  25.   while((s = (string*)textlines.pop()) != 0)
  26.     cout << *s << endl;
  27. } ///:~
  28.