stack4test.cpp
来自「C++编程思想第二版第一册答案」· C++ 代码 · 共 28 行
CPP
28 行
//: C13:Stack4Test.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
//{L} Stack4
// Test new Stack
#include "Stack4.h"
#include "../require.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
// Could also use command-line argument:
ifstream file("Stack4Test.cpp");
assure(file, " Stack4Test.cpp");
Stack textlines;
string line;
while(getline(file, line))
textlines.push(new string(line));
// 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 + -
显示快捷键?