stktst11.cpp

来自「Thinking_in_C___2.rar」· C++ 代码 · 共 30 行

CPP
30
字号
//: C13:Stktst11.cpp
// From Thinking in C++, 2nd Edition
// at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
//{L} Stack11
// Test new Stack
#include <iostream>
#include <fstream>
#include "../require.h"
#include "Stack11.h"
#include "Strings.h"
using namespace std;

int main() {
  // Could also use command-line argument:
  ifstream file("stktst11.cpp");
  assure(file, "stktst11.cpp");
  const int bufsize = 100;
  char buf[bufsize];
  Stack textlines;
  // Read file and store lines in the Stack:
  while(file.getline(buf,bufsize))
    textlines.push(String::make(buf));
  // Pop lines from the Stack and print them:
  String* s;
  while((s = (String*)textlines.pop()) != 0)
    cout << *s << endl;
} ///:~

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?