测试一下发博客文章。

粗体斜体下划线绿色红色

微软雅黑宋体隶书。

安全模式启动Office程序Excel:excel.exe /safe

代码段测试:

#include <iostream>
#include <algorithm> 
using namespace std;

int main()
{
  int A[] = {1,2,3};
  const int N = sizeof(A) / sizeof(int);

  int iCount = 1;
  for(int i = N; i >= 1; --i)
      iCount *= i;

  for(int i = iCount; i >=1; --i)
  {
      prev_permutation(A, A+N);
      cout << "After " << iCount - i + 1 << "th prev_permutation: ";
      copy(A, A+N, ostream_iterator<int>(cout, " "));
      cout << endl;    
  }

  int B[] = {2,3,1};
  const int N1 = sizeof(B) / sizeof(int);
  next_permutation(B, B+N1);
  cout << "After prev_permutation: ";
  copy(B, B+N1, ostream_iterator<int>(cout, " "));
  cout << endl;

  prev_permutation(B, B+N1);
  cout << "After next_permutation: ";
  copy(B, B+N1, ostream_iterator<int>(cout, " "));
  cout << endl;

  prev_permutation(B, B+N1);
  cout << "After next_permutation: ";
  copy(B, B+N1, ostream_iterator<int>(cout, " "));
  cout << endl;
}