prog20_09.cpp

来自「一本语言类编程书籍」· C++ 代码 · 共 24 行

CPP
24
字号
// Program 20.09 Full "random access" Integer iterator  File: prog20_09.cpp
#include <iostream>
#include <algorithm>
#include "Integer.h"
using std::cout;
using std::endl;

int main() {
  Integer F1(-1);
  Integer L1(10);
  cout << "The values [-1..10) in forward order: " << endl; 
  copy (F1, L1, std::ostream_iterator<int>(cout, " "));
  cout << endl;

  typedef std::reverse_iterator<Integer> CountDown;
  CountDown F2(10);
  CountDown L2(-1);
  cout << "the values (10..-1] in reverse order: " << endl; 
  copy (F2, L2, std::ostream_iterator<int>(cout, " "));
  cout << endl;

  return 0;
}

⌨️ 快捷键说明

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