测试一下发博客文章。

粗体斜体下划线绿色红色

微软雅黑宋体隶书。

安全模式启动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;
}

相关文章:

  • 2021-07-07
  • 2021-08-11
  • 2021-07-23
  • 2021-07-15
  • 2021-07-10
  • 2021-07-24
  • 2021-12-28
  • 2021-10-24
猜你喜欢
  • 2022-12-23
  • 2022-01-23
  • 2021-08-08
  • 2021-10-19
  • 2021-09-28
  • 2022-03-04
  • 2022-12-23
相关资源
相似解决方案