递归求数组全排

#include<iostream>
using namespace std;
#include<string>
int arry[10] = { 1,2,3,4,5,6,7,8,9,10 };
int hash_arry[10] = { 0 };
int mark_arry[10] = { 0 };
int c=0;
int index = 0;
void creat()
{
	if (index >= 10)
	{
		c++;
		return;
	}
	for (int i = 0; i < 10; i++)
	{
		if (mark_arry[i] == 0)
		{
			mark_arry[i] = 1;
			hash_arry[index++] = arry[i];
			creat();
			index--;
			mark_arry[i] = 0;

		}
	}

}
int main()
{
	creat();
	cout << c;
}
上一篇:[转载]Arguments


下一篇:记一次高并发场景下.net监控程序数据上报的性能调优